Description Usage Arguments Details Value Author(s) References See Also Examples
This function generates m random long only portfolios with n investments with each investment weight bounded in an interval and the sum of the weights equals a given amount. The number of non-zero positions is k. This function is used to test the algorithm that generates the random portfolios.
1 2 | rlongonly.test(m, n = 2, k = n, segments = NULL, x.t = 1, x.l = 0,
x.u = x.t, max.iter = 1000)
|
m |
A positive integer value for the number of portfolios |
n |
A positive integer value for the number of investments in each portfolio |
k |
A positive integer value for the number of non zero weights |
segments |
A vector or list of vectors that defines the portfolio segments |
x.t |
A positive numeric value for the sum of investment weights |
x.l |
A positive numeric value for the lower bound of an investment weight |
x.u |
A positive numeric value for the upper bound of an investment weight |
max.iter |
A positive integer value for the number of rejection iterations |
The function executes the function random.longonly.test
using the R function
lapply
. The result which is a list contains the investment weight vectors and number
of iterations. Thse data are stored in a matrix of investment weights and a vector
of iterations. These arrays are returned as a list.
A list with two named components.
xmatrix |
A numerical m \times n matrix of investment weights |
iters |
An integer m \times 1 vector for the number iterations used to obtain the investment weights |
Frederick Novomestky fn334@nyu.edu
Cheng, R. C. H., 1977. The Generation of Gamma Variables with Non-integral Shape Parameter, Journal of the Royal Statistical Society, Series C (Applied Statistics), 26(1), 71.
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.
1 2 3 4 5 6 7 8 | ###
### generate 100 long only portfolios with 30 investments and 30 non-zero positions
###
x.result <- rlongonly.test( 100, 30 )
###
### generate 100 long only portfolios with 30 investments and 10 non-zero positions
###
y.result <- rlongonly.test( 100, 30, 10 )
|
Loading required package: truncdist
Loading required package: stats4
Loading required package: evd
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.