assetsSelect             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:

     Selet assets from Multivariate Asset Sets based  on clustering.

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

     assetsSelect(x, method = c("hclust", "kmeans"), control = NULL, ...)

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

       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 clustering method should be used? 
          Either 'hclust' for hierarchical clustering of
          dissimilarities, or 'kmeans' for k-means clustering. 

 control: a character string with two entries controlling the
          parameters used in the underlying cluster algorithms. If set
          to NULL, then   default settings are taken: For hierarchical
          clustering this is  'method=c(measure="euclidean",
          method="complete")',  and for kmeans clustering this is
          'method=c(centers=3, algorithm="Hartigan-Wong")'. 

     ...: optional arguments to be passed. Note, for the k-means
          algorithm the number of centers has to be specified! 

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

     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. 

     Note, the hierarchical clustering method has in addition a plot
     method.

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

     if 'use="hclust"' was selected then the function returns a S3
     object of class "hclust", otherwise if 'use="kmeans"' was 
     selected then the function returns an object of class "kmeans". 

     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.

_R_e_f_e_r_e_n_c_e_s:

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

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

     ## LPP -
        LPP = as.timeSeries(data(LPP2005REC))
        colnames(LPP)
         
     ## assetsSelect -
        # hclust Clustering:
        hclust = assetsSelect(LPP, "hclust") 
        plot(hclust)
        
     ## assetsSelect -  
        # kmeans Clustering:
        assetsSelect(LPP, "kmeans", control = 
          c(centers = 3, algorithm = "Hartigan-Wong"))

