rgeneral.test: Generate random general portfolios

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

Description

This function generates m random general portfolios with n investments each that can have k 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 The function is used to evaluate the performance of the portfolio generation algorithm.

Usage

1
rgeneral.test(m, n = 2, k = n, segments = NULL, p = 0.5, x.u = 1)

Arguments

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 long and short positions

segments

A vector or list of vectors that defines the portfolio segments

p

A positive numeric value for the probability that a position is positive

x.u

A positive numeric value for the maximum absolute exposure to an investment

Details

The function executes the function random.general.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.

Value

A list with two named components.

xmatrix

An m \times n numerical matrix of investment weights

iters

An m \times 1 integer vector for the number of iterations used to obtain the investment weights

Author(s)

Frederick Novomestky fn334@nyu.edu

See Also

random.general.test

Examples

 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
###
### 100 long only portfolios of 30 investments
###
x.long <- rgeneral.test( 100, 30, p=1.0 )
y.long <- rgeneral.test( 100, 30, 10, p=1.0 )
###
### 100 short only portfolios of 30 investments
###
x.short <- rgeneral.test( 100, 30, p=0.0 )
y.short <- rgeneral.test( 100, 30, 10, p=0.0 )
###
### 100 long short portfolios of 30 investments
###
x.long.short <- rgeneral.test( 100, 30, p=0.5 )
y.long.short <- rgeneral.test( 100, 30, 10, p=0.5 )
###
### 100 long bias portfolios of 30 investments
###
x.long.bias <- rgeneral.test( 100, 30, p=0.7 )
y.long.bias <- rgeneral.test( 100, 30, 10, p=0.7 )
###
### 100 short bias portfolios of 30 investments
###
x.short.bias <- rgeneral.test( 100, 30, p=0.3 )
y.short.bias <- rgeneral.test( 100, 30, 10, p=0.3 )

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