Description Usage Arguments Details Value Author(s) See Also Examples
This function assigns the given investment weights to larget portfolios using the investment indices in the segments
1 | set.segments(portfolios, n, segments)
|
portfolios |
A vector or matrix of investment weights for the segments |
n |
A positive integer value for the number of investments in the larger portfolio |
segments |
A vector or list of vectors that defines the segment investments |
A private function vector.set.segments
is used to take weights in a given portfolio
vector and assign them to a larger vector using the collapsed investment index vector. If
the portfolios
argument is a matrix, then the R function apply
is used to
perform this task for each row vector.
A vector or matrix.
Frederick Novomestky fn334@nyu.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ###
### simulate 300 long only portfolios with 30 investments
###
portfolios <- rlongonly( 300, 30 )
###
### define six segments with five investments in each
###
segment1 <- 1:5
segment2 <- 11:15
segment3 <- 21:25
segment4 <- 31:35
segment5 <- 41:45
segment6 <- 51:55
segments <- list( segment1, segment2, segment3, segment4, segment5, segment6 )
newPortfolios <- set.segments( portfolios, 60, segments )
|
Loading required package: truncdist
Loading required package: stats4
Loading required package: evd
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.