extract.segments: Extract Investment Segment Exposures

Description Usage Arguments Details Value Author(s) Examples

Description

This function extracts the investment exposures from one or more portfolios for the specified investment segments.

Usage

1
extract.segments(portfolios, segments, collapse = FALSE)

Arguments

portfolios

A vector or matrix that defines the portfolios

segments

A vector or list of vectors that defines the investment segments

collapse

A logical value. If TRUE, only the investment segment exposures are returned

Details

If the collapse argument is FALSE, the segment complement exposures are zero and the investment segment exposures are taken from the portfolios. If the collapse argument is TRUE, then only the investment segment exposures are returned. The private function vector.extract.segments is used to perform the extraction. For matrices of investment weights, the apply function is used with vector.extract.segments to obtain a matrix of extracted segment weights. The transpose of this matrix is returned.

Value

A vector for one portfolio or a matrix for multiple portfolios.

Author(s)

Frederick Novomestky fn334@nyu.edu

Examples

1
2
3
4
5
6
7
8
onePortfolio <- random.longonly( 10 )
I <- list()
I[[1]] <- c( 1, 2, 3 )
I[[2]] <- c( 4, 5 )
I[[3]] <- c( 6, 7 )
I[[4]] <- c( 8, 9, 10 )
extract.segments( onePortfolio, I[[1]], FALSE )
extract.segments( onePortfolio, I[[1]], TRUE )

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