sampleCovMat            package:bayesSurv            R Documentation

_C_o_m_p_u_t_e _a _s_a_m_p_l_e _c_o_v_a_r_i_a_n_c_e _m_a_t_r_i_x.

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

     This function computes a sample covariance matrix.

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

     sampleCovMat(sample)

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

  sample: a 'matrix' or 'data.frame' with sampled values in rows. I.e.
          number of rows of 'sample' determines a sample size, number
          of columns of 'sample' determines a dimension of the
          distribution from which it was sampled. 

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

     When y[1], ..., y[n] is a sequence of p-dimensional vectors y[i]
     the sample covariance matrix S is equal to

           S = (1/(n-1)) sum[i=1][n] (y[i] - m)(y[i] - m)'

     where 

                     m = (1/n) sum[i=1][n] y[i].

     When n=1 the function returns just sum of squares.

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

     This function returns a matrix.

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

     Arno&#353t Kom&#225rek komarek@karlin.mff.cuni.cz

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

       ## Sample some values
       z1 <- rnorm(100, 0, 1)           ## first components of y
       z2 <- rnorm(100, 5, 2)           ## second components of y
       z3 <- rnorm(100, 10, 0.5)        ## third components of y

       ## Put them into a data.frame
       sample <- data.frame(z1, z2, z3)

       ## Compute a sample covariance matrix
       sampleCovMat(sample)

