random.bounded: Random bounded portfolio

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

Description

This function generates a portfolio of n investments where the weights are constrained to be within investment specific lower and upper bounds.

Usage

1
random.bounded(n = 2, x.t = 1, x.l = rep(0, n), x.u = rep(x.t, n), max.iter = 1000)

Arguments

n

An integer value for the number of investments in the portfolio

x.t

Numeric value for the sum of the investment weights

x.l

Numeric vector for the lower bounds on the investment weights

x.u

Numeric vector for the upper bound on the investment weights

max.iter

An integer value for the maximum iteration in the acceptance rejection loop

Details

The simulation method is an extension the method in the function random.longonly. The desired portfolio {\mathbf{x}} = {≤ft[ {\begin{array}{*{20}{c}} {{x_1}}&{{x_2}}& \cdots &{{x_n}} \end{array}} \right]^\prime } is defined {\mathbf{x}} = {{\mathbf{x}}_l} + {\mathbf{z}}, that is, the sum of a portfolio of lower bounds with total allocation {\mathbf{1'}}\;{{\mathbf{x}}_l} and the portfolio {\mathbf{z}} with total allocation {x_t} - {\mathbf{1'}}\,{x_l}. This second portfolio has non-negative weights and upper bounds equal to the range vector {{\mathbf{x}}_r} = {{\mathbf{x}}_u} - {{\mathbf{x}}_l}.

In the function random.longonly, all investment weights have the same lower and upper bounds. In random.bounded investment weights can have different bounds. Therefore, rather than performing a random sampling without replacement of the weights, random.bounded begins with the selection of the indices {i_1},{i_2}, … ,{i_n} as a random sample without replacement of the set of investment weight subscripts. The subscript of the index sample defines the order in which the random weights are generated. The allocations in {\mathbf{z}} are scaled uniform random variables.

After completing this acceptance rejection procedure, the function determines any unallocated surplus which is the total allocation minus the sum of the lower bounds. If there is any surplus, then the allocation gap is computed as the difference of the upper bounds and the current investment allocations. Investments are chosen at random and minimum of the surplus and the gap is added to the allocation. The surplus is reduced by this amount and the adjustment is performed for each investment.

Value

A numeric vector with investment weights.

Author(s)

Frederick Novomestky fn334@nyu.edu

References

Cheng, R. C. H., 1977. The Generation of Gamma Variables with Non-integral Sape Parameter, Journal of the Royal Statistical Society, Series C (Applied Statistics), 26(1), 71.

Kinderman, A. J. and J. G. Ramage, 1976. Computer Generation of Normal Random Variables, Journal of the American Statistical Association, December 1976, 71(356), 893.

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.

Tadikamalla, P. R., (1978). Computer generation of gamma random variables - II, Communications of the ACM, 21 (11), November 1978, 925-928.

See Also

random.longonly

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
###
### standard long only portfolio
###
p.1 <- random.bounded( 30, 1 )
###
### 3% lower bound for all investments
### 100% upper bound for all investments
###
x.lb.all.3 <- rep( 0.03, 30 )
x.ub.all.100 <- rep( 1, 30 )
p.2 <- random.bounded( 30, 1, x.l = x.lb.all.3, x.u= x.ub.all.100 )
###
### 4% upper bound for all investments
### 3% lower bound for all investments
x.ub.all.4 <- rep( 0.04, 30 )
p.3 <- random.bounded( 30, 1, x.l = x.lb.all.3, x.u = x.ub.all.4 )
###
### 2% lower bound for 1-10, 3% lower bound for 11-20, 2% lower bound for 21-30
### 100% upper bound for all investments
###
x.lb.2.3.2 <- c( rep( 0.02, 10 ), rep( 0.03, 10 ), rep( 0.02, 10 ) )
p.4 <- random.bounded( 30, 1, x.l = x.lb.2.3.2, x.u = x.ub.all.100 )
###
### 3% lower bound for 1-10, 2% lower bound for 11-20, 3% lower bound for 21-30
### 100% upper bound for all investments
###
x.lb.3.2.3 <- c( rep( 0.03, 10 ), rep( 0.02, 10 ), rep( 0.03, 10 ) )
p.5 <- random.bounded( 30, 1, x.l = x.lb.3.2.3, x.u = x.ub.all.100 )
###
### 2% lower bound for 1-10, 3% lower bound for 11-20, 2% lower bound for 21-30
### 4% upper bound for all investments
###
x.lb.2.3.2 <- c( rep( 0.02, 10 ), rep( 0.03, 10 ), rep( 0.02, 10 ) )
p.6 <- random.bounded( 30, 1, x.l = x.lb.2.3.2, x.u = x.ub.all.4 )
###
### 3% lower bound for 1-10, 2% lower bound for 11-20, 3% lower bound for 21-30
### 4% upper bound for all investments
###
x.lb.3.2.3 <- c( rep( 0.03, 10 ), rep( 0.02, 10 ), rep( 0.03, 10 ) )
p.7 <- random.bounded( 30, 1, x.l = x.lb.3.2.3, x.u = x.ub.all.4 )
###
### 3% lower bound for all investments
### 4% upper bound for 1-10, 5% upper bound for 11-20 and 4% upper boundfor 21-30
###
x.ub.4.5.4 <- c( rep( 0.04, 10 ), rep( 0.05, 10 ), rep( 0.04, 10 ) )
p.8 <- random.bounded( 30, 1, x.l = x.lb.all.3, x.u= x.ub.4.5.4 )
###
### 3% lower bound for all investments
### 5% upper bound for 1-10, 4% upper bound for 11-20 and 5% upper bound for 21-30
###
x.ub.5.4.5 <- c( rep( 0.05, 10 ), rep( 0.04, 10 ), rep( 0.05, 10 ) )
p.9 <- random.bounded( 30, 1, x.l = x.lb.all.3, x.u= x.ub.5.4.5 )
###
### 3% lower bound for 1-10, 2% for 11-20, 3% for 21-30
### 4% upper bound for 1-10  5% for 11-20  4% for 21-30
###
p.10 <- random.bounded( 30, 1, x.l = x.lb.3.2.3, x.u = x.ub.4.5.4 )
###
### 2% lower bound for 1-10, 3% for 11-20, 2% for 21-30
### 4% upper bound for 1-10  5% for 11-20  4% for 21-30
###
p.11 <- random.bounded( 30, 1, x.l = x.lb.2.3.2, x.u = x.ub.4.5.4 )
###
### 3% lower bound for 1-10, 2% for 11-20, 3% for 21-30
### 5% upper bound for 1-10  4% for 11-20  5% for 21-30
###
p.12 <- random.bounded( 30, 1, x.l = x.lb.3.2.3, x.u = x.ub.5.4.5 )
###
### 2% lower bound for 1-10, 3% for 11-20, 2% for 21-30
### 5% upper bound for 1-10  4% for 11-20  5% for 21-30
###
p.13 <- random.bounded( 30, 1, x.l = x.lb.2.3.2, x.u = x.ub.5.4.5 )

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