Learn R Programming

fAssets (version 4023.85)

assets-arrange: Rearranging Assets Columnwise

Description

Allows to rearrange a set of assets columnwise.

Usage

assetsArrange(x, method = c("pca", "hclust", "abc"), ...)

pcaArrange(x, robust = FALSE, ...) hclustArrange(x, method = c("euclidean", "complete"), ...) abcArrange(x, ...) orderArrange(x, ...) sampleArrange(x, ...) statsArrange(x, FUN = colMeans, ...)

Value

a character vector with the rearranged assets names.

Arguments

x

any rectangular time series object which can be converted by the function as.matrix() into a matrix object, e.g. like an object of class timeSeries, data.frame, or mts.

method

a character string, which method should be applied to reaarnage the assests? Either "pca" which arranges the columns by an eigenvalue decomposition, "hclust" which arrangtes the columns by hierarchical clustering, "abc" which arrangtes the columns alphabetically, "order" which arrangtes the columns by the order function, "sample" which arranges the columns randomly, or "stats" which arranges by an statistical strategy.

robust

a logical flag. Should robust statistics applied?

FUN

function anme of the statistical function to be applied.

...

optional arguments to be passed.

Author

Diethelm Wuertz for the Rmetrics port.

References

Wuertz, D., Chalabi, Y., Chen W., Ellis A. (2009); Portfolio Optimization with R/Rmetrics, Rmetrics eBook, Rmetrics Association and Finance Online, Zurich.

Examples

Run this code
## LPP -
   # Load Swiss Pension Fund Data:
   LPP <- LPP2005REC[, 1:3]
   head(LPP)
    
## assetsArrange -
   # Arrange Assets Columns:
   assetsArrange(x=LPP, "pca")
   assetsArrange(x=LPP, "hclust")
   assetsArrange(x=LPP, "abc")
   
## Alternative Usage -
   pcaArrange(x=LPP, robust=FALSE)
   pcaArrange(x=LPP, robust=TRUE)
   hclustArrange(x=LPP, method = c("euclidean", "complete"))
   abcArrange(x=LPP)
   orderArrange(x=LPP)
   sampleArrange(x=LPP)
   statsArrange(x=LPP, FUN=colMeans)

Run the code above in your browser using DataLab