AssetsSelection           package:fAssets           R Documentation

_S_e_l_e_c_t_i_n_g _A_s_s_e_t_s _f_r_o_m _M_u_l_t_i_v_a_r_i_a_t_e _A_s_s_e_t _S_e_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

  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. 

_D_e_t_a_i_l_s:

     *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.

_V_a_l_u_e:

     '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'.

_A_u_t_h_o_r(_s):

     Diethelm Wuertz for the Rmetrics port.

_S_e_e _A_l_s_o:

     'MultivariateDistribution'.

_E_x_a_m_p_l_e_s:

     ## 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)  

