pputil.value {pprobeSup}R Documentation

Utility function of portfolio value

Description

Returns a "utility" based on the scenarios of the portfolio value – one number for each random portfolio.

Usage

pputil.value(rp, scenarios, level = NULL, verbose = FALSE)
pputil.valueWt(rp, scenarios, sweights, level = NULL, verbose = FALSE)

Arguments

rp

a random portfolio object.

scenarios

a three-dimensional array: times in rows, assets in columns and scenarios in the third dimension.

sweights

a vector of weights for the scenarios. This needs to have the same length as the number of scenarios in the scenarios object. There is no constraint on what the weights can sum to.

level

if NULL, then the mean utility (portfolio value) is returned.

Otherwise, should be a number between 0 and 1 giving the quantile of the utility to return.

verbose

logical value, if TRUE, then information is printed about the result.

Value

a numeric vector as long as the number of random portfolios. The utility for each portfolio and scenario is the portfolio value.

For pputil.value the mean or level quantile of the portfolio values (across scenarios) is returned for each random portfolio.

For pputil.valueWt the weighted mean or level weighted quantile of the portfolio values (across scenarios) is returned for each random portfolio.

Side effects

if verbose is TRUE, then printing is done.

Testing status

In test suite, mildly tested.

Revision

This help file was last revised 2013 May 02.

See Also

scenario.optimizer, pputil.fourmoments, pputil.meanvar, pputil.omega.

Examples

# maximize expected value
meanvalueOpt  <- scenario.optimizer(scenWith1timepoint, 
	utility=pputil.value, prices=currentPrices,
	max.weight=.07, gross=1e7, long.only=TRUE, 
	existing=currentPositions, port.size=c(20,30))

# maximize 20th percentile of value
q20valueOpt  <- scenario.optimizer(scenWith1timepoint, 
	utility=pputil.value, extraArgs=list(level=.2),
	prices=currentPrices,
	max.weight=.07, gross=1e7, long.only=TRUE, 
	existing=currentPositions, port.size=c(20,30))

# weight scenarios, maximize 30th percentile
weightValueOpt  <- scenario.optimizer(scenWith1timepoint, 
	utility=pputil.valueWt, 
	extraArgs=list(level=.3, sweights=vectorLengthNumScenarios),
	prices=currentPrices,
	max.weight=.07, gross=1e7, long.only=TRUE, 
	existing=currentPositions, port.size=c(20,30))

# load data
require(pprobeData)

# create a scenario for monthly values
monScen <- pp.historyScenarios(xassetPrices[,1:50], 
	template=c(0,21), number=100)

# use the scenario (as a matrix)
monOPt <- scenario.optimizer(monScen[2,,], utility=pputil.value,
        prices=monScen[1,,1],
        max.weight=.07, gross=1e7, long.only=TRUE,
        existing=NULL, port.size=c(20,30)

# use the scenario (as a one-row 3D array)
monOPt <- scenario.optimizer(monScen[2,,, drop=FALSE], 
	utility=pputil.value, prices=monScen[1,,1],
        max.weight=.07, gross=1e7, long.only=TRUE,
        existing=NULL, port.size=c(20,30)

[Package pprobeSup version 1.00 Index]