pp.historyScenarios {pprobeSup}R Documentation

Create scenarios from historical prices

Description

Takes a matrix of prices and produces a three-dimensional array of scenarios based on the historical behavior.

Usage

pp.historyScenarios(history, template, number = NULL, 
	which = NULL, prices = NULL, replace = TRUE)

Arguments

history

a matrix of positive numbers with column names for the assets. Missing values are not accepted.

template

vector with at least two non-negative values giving the position of the rows to be put into the scenarios relative to the starting position.

This is typically in increasing order and begins with 0.

number

the number of scenarios to be generated with random starting positions.

Only one of number and which can be given.

which

a vector of the locations of starting positions (rows in history) to be used.

Only one of number and which can be given.

prices

a named numeric vector of the prices to be used as the starting prices.

If not given, then the last row of history is used.

replace

logical value: when random locations are generated, are repeated values allowed?

Value

a three-dimensional array that is length(template) by length(prices) by either number or length(which). The first row of all slices is equal to prices.

Side effects

if number is given, then the random seed is created or modified.

Testing status

In test suite, mildly tested.

Revision

This help file was last revised 2013 May 02.

See Also

pp.priceScenarios, pp.normalScenarios, scenario.optimizer.

Examples

# attach data
require(pprobeData)

xas.histscenweek <- pp.historyScenarios(xassetPrices[, 1:50], 
	template=c(0, 4), number=100)

[Package pprobeSup version 1.00 Index]