AssetsSelection {fAssets}R Documentation

Selecting Assets from Multivariate Asset Sets

Description

A collection and description of functions which allow for the selection and clustering of individual assets from portfolios using several kinds of clustering approaches.

The functions are:

assetsSelect Asset Selection from Portfolios.

Usage

assetsSelect(x, method = c("hclust", "kmeans"), 
    kmeans.centers = 5, kmeans.maxiter = 10, doplot = TRUE, ...)

Arguments

doplot [assetsSelect] -
a logical, should a plot be displayed?
kmeans.centers [assetsSelect] -
either the number of clusters or a set of initial cluster centers. If the first, a random set of rows in x are chosen as the initial centers.
kmeans.maxiter [assetsSelect] -
the maximum number of iterations allowed.
method [assetsSelect] -
a character string, which clustering method should be applied? Either hclust for hierarchical clustering of dissimilarities, or kmeans for k-means clustering.
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.
... optional arguments to be passed.

Details

Assets Selection:

The function assetsSelect calls the functions hclust or kmeans from R's "stats" package. hclust performs a hierarchical cluster analysis on the set of dissimilarities hclust(dist(t(x))) and kmeans performs a k-means clustering on the data matrix itself.

Value

assetsSelect
if method="hclust" was selected then the function returns a S3 object of class "hclust", otherwise if method="kmeans" was selected then the function returns an obkject of class list. For details we refer to the help pages of hclust and kmeans.

Author(s)

Diethelm Wuertz for the Rmetrics port.

See Also

MultivariateDistribution.

Examples

## berndtInvest -
   data(berndtInvest)
   # Market and Interest Rate columns from data frame,
   berndtAssets.tS = as.timeSeries(berndtInvest)[, -c(10, 17)]
   head(berndtAssets.tS)
    
## assetsSelect -
   # Hierarchical Clustering:
   clustered = assetsSelect(berndtAssets.tS, doplot = FALSE)
   clusteredAssets.tS = berndtAssets.tS[, c(clustered$order[1:4])]
   colnames(clusteredAssets.tS)
   # Cluster Dendogram:
   par(mfrow = c(1, 1))
   plot(clustered)  

[Package fAssets version 260.72 Index]