Description Usage Arguments Details Value Author(s) See Also Examples
This function generates m random general portfolios with n investments each. There are k positions that can be positive or negative. The probability that a given investment weight is positive is p. The maximum absolute exposure is x.u which has 1 as the default
1 |
m |
A positive integer value for the number of portfolios |
n |
A positive integer value for the number of investments in the portfolio |
k |
A positive integer value for the number of non-zero investment positions |
segments |
A vector or list of vectors that defines the portfolio segments |
p |
A positive numeric value for the probability that a non-zero position is positive |
x.u |
A positive numeric value for the maximum absolute exposure to an investment |
The function executes the function random.general
using the R function
sapply
. The result returned is the transpose of the matrix generated in the previous
step.
An m \times n numeric matrix. The rows are the portfolios and the columns are the investment weights for each portfolio
Frederick Novomestky fn334@nyu.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ###
### 100 long only portfolios of 30 investments with 30 non-zero positions
###
x.long <- rgeneral( 100, 30, p=1.0 )
###
### 100 long only portfolios of 30 investments with 10 non-zero positions
###
y.long <- rgeneral( 100, 30, 10, p=1.0 )
###
### 100 short only portfolios of 30 investments with 30 non-zero positions
###
x.short <- rgeneral( 100, 30, p=0.0 )
###
### 100 short only portfolios of 30 investments with 10 non-zero positions
###
y.short <- rgeneral( 100, 30, 10, p=0.0 )
###
### 100 long short portfolios of 30 investments with 30 non-zero positions
###
x.long.short <- rgeneral( 100, 30, p=0.5 )
###
### 100 long short portfolios of 30 investments with 10 non-zero positions
###
y.long.short <- rgeneral( 100, 30, 10, p=0.5 )
###
### 100 long bias portfolios of 30 investments with 30 non-zero positions
###
x.long.bias <- rgeneral( 100, 30, p=0.7 )
###
### 100 long bias portfolios of 30 investments with 10 non-zero positions
###
y.long.bias <- rgeneral( 100, 30, 10, p=0.7 )
###
### 100 short bias portfolios of 30 investments with 30 non-zero positions
###
x.short.bias <- rgeneral( 100, 30, p=0.3 )
###
### 100 short bias portfolios of 30 investments with 10 non-zero positions
###
y.short.bias <- rgeneral( 100, 30, 10, p=0.3 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.