var.acomp            package:compositions            R Documentation

_V_a_r_i_a_n_c_e_s _a_n_d _c_o_v_a_r_i_a_n_c_e_s _o_f _a_m_o_u_n_t_s _a_n_d _c_o_m_p_o_s_i_t_i_o_n_s

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

     Compute the (co)variance matrix in the several approaches of
     compositional and amount data analysis.

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

               var(x,...)
               ## Default S3 method:
               var(x, y=NULL, na.rm=FALSE, use, ...)
               ## S3 method for class 'acomp':
               var(x,y=NULL,...)
               ## S3 method for class 'rcomp':
               var(x,y=NULL,...)
               ## S3 method for class 'aplus':
               var(x,y=NULL,...)
               ## S3 method for class 'rplus':
               var(x,y=NULL,...)
               ## S3 method for class 'rmult':
               var(x,y=NULL,...)
               cov(x,y=x,...)
               ## Default S3 method:
               cov(x, y=NULL, use="all.obs", method=c("pearson",
         "kendall", "spearman"), ...)
               ## S3 method for class 'acomp':
               cov(x,y=NULL,...)
               ## S3 method for class 'rcomp':
               cov(x,y=NULL,...)
               ## S3 method for class 'aplus':
               cov(x,y=NULL,...)
               ## S3 method for class 'rplus':
               cov(x,y=NULL,...)
               ## S3 method for class 'rmult':
               cov(x,y=NULL,...)
               

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

       x: a dataset, eventually of amounts or compositions

       y: a second dataset, eventually of amounts or compositions

   na.rm: see 'var'

     use: see 'var'

  method: see 'cov'

     ...: further arguments to 'var' e.g. 'use'

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

     The basic functions of 'var', 'cov' are turned to S3-generics. The
     original versions are copied to the default method. This allows us
     to introduce generic methods to handle variances and covariances
     of other datatypes such as amounts or compositions. 

     If classed amounts or compositions are involved, they are
     transformed with their corresponding transforms, using the
     centered default transform ('cdt'). That implies that the
     variances have to be interpreded in a log scale level for  'acomp'
     and 'aplus'. 
      We should be aware that variance matrices of compositions are
     singular. They can be transformed to the correponding nonsingular
     variances of ilr or ipt -space by 'clrvar2ilr'.

     In R versions older than v2.0.0, 'var' and 'cov' were defined in
     package ``base'' instead of in ``stats''. This might produce some
     misfunction.

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

     The variance matrix of x or the covariance matrix of x and y.

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

     'cdt', 'clrvar2ilr', 'clo', 'mean.acomp', 'acomp', 'rcomp',
     'aplus', 'rplus', 'variation'

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

     data(SimulatedAmounts)
     mean.col(sa.lognormals)
     var(acomp(sa.lognormals))
     var(rcomp(sa.lognormals))
     var(aplus(sa.lognormals))
     var(rplus(sa.lognormals))
     cov(acomp(sa.lognormals5[,1:3]),acomp(sa.lognormals5[,4:5]))
     cov(rcomp(sa.lognormals5[,1:3]),rcomp(sa.lognormals5[,4:5]))
     cov(aplus(sa.lognormals5[,1:3]),aplus(sa.lognormals5[,4:5]))
     cov(rplus(sa.lognormals5[,1:3]),rplus(sa.lognormals5[,4:5]))
     cov(acomp(sa.lognormals5[,1:3]),aplus(sa.lognormals5[,4:5]))

     svd(var(acomp(sa.lognormals)))

