Description Usage Arguments Details Value Author(s) Examples
This function generates a random portfolio of n investments in which there are only k positive equal weights. The weights sum to the given value x_t.
1 | random.equal(n = 2, k = n, segments = NULL, x.t = 1)
|
n |
A positive integer for the number of investments in the portfolio |
k |
A positive integer for the number of investments with positive equal weights |
segments |
A vector or list of vectors that defines the portfolio segments |
x.t |
A positive numeric value for the sum of weights |
The R function sample
is used to generate a simple random sample without replacement
of k values from the integers 1,2, … ,n. These are the subscripts into
an n \times 1 zero vector to assign the equal weight x_t / k.
An n \times 1 numeric vector of investment weights for the equal weighted portfolio. The weights are proportions of invested capital.
Frederick Novomestky fn334@nyu.edu
1 | x <- random.equal( 30, 5 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.