random.longonly: Random long only portfolio

Description Usage Arguments Details Value Author(s) References Examples

Description

This function generates a vector of investment weights for a portfolio where the weights are non-negative, do not exceed a given upper and and the sum of the weights is a given total. The number of non zero positions is k.

Usage

1
2
random.longonly(n = 2, k = n, segments = NULL, x.t = 1, x.l=0, 
x.u = x.t, max.iter = 1000)

Arguments

n

An integer value for the number of investments in the portfolio

k

An integer value for the number of non zero weights

segments

A vector or list of vectors that defines the portfolio segments

x.t

Numeric value for the sum of the investment weights

x.l

Numeric value for the lower bound on an investment weight

x.u

Numeric value for the upper bound on an investment weight

max.iter

An integer value for the maximum iteration in the acceptance rejection loop

Details

The simulation method combines the acceptance rejection method used for generating gamma and gaussian random variables with a continuous analog of the method used in Ross (2006) to generate a vector of multinomial random variables. n - 1 random variables are constructed where the first U_1 is uniformly distributed in the interval ≤ft[ X_l, X_t \right]. Random variable U_2 is a uniform random variable in ≤ft[ {X_l,X_t - U_1 } \right] given U_1. Random variable U_3 is a uniform random variable in ≤ft[ {0,X_t - U_1 - U_2 } \right] given U_1 and U_2. This conditional generation of uniform random variables stops with U_{n - 1} which is uniform on ≤ft[ {X_l,X_t - ∑\limits_{j = 1}^{n - 2} {U_j } } \right] given the first n - 2 random variables. if X_t - ∑\limits_{j = 1}^{n - 1} {U_j } is less than or equal to X_u, then the final random variable is U_n = X_t - ∑\limits_{j = 1}^{n - 1} {U_j }. Otherwise, the above procedure of generating uniform random variables conditionally is repeated until this condition is satisfied. The vector {\mathbf{W}} is a random sample of size n of the values in vector {\mathbf{X}} where the sampling is performed without replacement.

Value

A numeric vector with investment weights.

Author(s)

Frederick Novomestky fn334@nyu.edu

References

Cheng, R. C. H., 1977. The Generation of Gamma Variables with Non-integral Sape Parameter, Journal of the Royal Statistical Society, Series C (Applied Statistics), 26(1), 71.

Kinderman, A. J. and J. G. Ramage, 1976. Computer Generation of Normal Random Variables, Journal of the American Statistical Association, December 1976, 71(356), 893.

Marsaglia, G. and T. A. Bray, 1964. A Convenient method for generating normal variables, SIAM Review, 6(3), July 1964, 260-264.

Ross, S. M. (2006). Simulation, Fourth Edition, Academic Press, New York NY.

Tadikamalla, P. R., (1978). Computer generation of gamma random variables - II, Communications of the ACM, 21 (11), November 1978, 925-928.

Examples

1
2
3
4
5
6
7
8
###
### long only portfolio of 30 investments with 30 non-zero positions
###
x <- random.longonly( 30 )
###
### long only portfolio of 30 investments with 10 non-zero positions
###
y <- random.longonly( 30, 10 )

Example output

Loading required package: truncdist
Loading required package: stats4
Loading required package: evd

rportfolios documentation built on May 2, 2019, 3:40 p.m.