rlongonly: Generate random long only portfolios

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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.

Usage

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

Arguments

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

Details

The function executes the function random.longonly using the R function sapply. The result returned is the transpose of the matrix generated in the previous step.

Value

A numeric m \times n matrix. The rows are the portfolios and the columns are the investment weights for each portfolio

Author(s)

Frederick Novomestky fn334@nyu.edu

See Also

random.longonly

Examples

1
2
3
4
5
6
7
8
###
### 100 long only portfolios of 30 investments with 30 non-zero positions
###
x.matrix <- rlongonly( 100, 30 )
###
### 100 long only portfolios of 30 investments with 10 non-zero positions
###
y.matrix <- rlongonly( 100, 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.