Learn R Programming

rportfolios (version 1.0-1)

random.benchmark.test: Random Naive Benchmark Portfolio

Description

This function generates a vector of investment weights for a benchmark portfolio where the weights are non-negative and the sume of the weights is a given total. The weights are naively derived from an i.i.d. sample of truncated random variables. This function is used to evaluate the performance of the portfolio generation algorithm.

Usage

random.benchmark.test(n = 2, k = n, segments = NULL, x.t = 1, margins = c("unif", "beta", "exp", "frechet", "gamma", "gev", "gpd", "gumbel", "lnorm", "logis", "norm", "weibull"), ...)

Arguments

n
A positive integer for the number of investments in the portfolio
k
A positive integer for the number of non-zero exposures or cardinality
segments
A vector or list of vectors that defines the investment segments
x.t
A positive real value for the sum of the investment exposures
margins
A character value for the underlying distribution of the truncated random variable. The default is a uniform distribution
...
Other arguments passed to the random variate simulation function

Value

A list with two named components.

Details

The details are described in the function random.benchmark.

See Also

random.benchmark

Examples

Run this code
###
### long only portfolio of 30 investments with 30 non-zero positions
### the margins of the truncated random variables are uniform
###
p.1 <- random.benchmark.test( 30 )
###
### long only portfolio of 30 investments with 10 non-zero positions
### the margins of the truncated random variables are uniform
###
p.2 <- random.benchmark.test( 30, 10 )
###
### long only portfolio of 30 investments with 30 non-zero positions
### the margins of the truncated random variables are log normal
### with zero log mean and unit log standard deviation
###
p.3 <- random.benchmark.test( 30, margins="lnorm", meanlog=0, sdlog=1 )
###
### long only portfolio of 30 investments with 10 non-zero positions
### the margins of the truncated random variables are log normal
### with zero log mean and unit log standard deviation
###
p.4 <- random.benchmark.test( 30, 10, margins="lnorm", meanlog=0, sdlog=1 )

Run the code above in your browser using DataLab