bdsmatrix              package:kinship              R Documentation

_C_r_e_a_t_e _a _s_p_a_r_s_e _s_y_m_m_e_t_r_i_c _b_l_o_c_k _d_i_a_g_o_n_a_l _m_a_t_r_i_x _o_b_j_e_c_t

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

     Sparse block diagonal matrices are used in the the large parameter
     matrices that can arise in random-effects coxph and survReg
     models.  This routine creates such a matrix.  Methods for these
     matrices allow them to be  manipulated much like an ordinary
     matrix, but the total memory use can be much smaller.

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

     bdsmatrix(blocksize, blocks, rmat, dimnames)

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

blocksize: vector of sizes for the matrices on the diagonal 

  blocks: contents of the diagonal blocks, strung out as a vector 

    rmat: the dense portion of the matrix, forming a right and lower
          border 

dimnames: a list of dimension names for the matrix 

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

     Consider the following matrix, which has been divided into 4
     parts.


                  1  2  0  0  0 | 4  5
                  2  1  0  0  0 | 6  7
                  0  0  3  1  2 | 8  8
                  0  0  1  4  3 | 1  1
                  0  0  2  3  5 | 2  2
                  --------------+-----
                  4  6  8  1  2 | 7  6
                  5  7  8  1  2 | 6  9

     The upper left is block diagonal, and can be stored in a
     compressed form without the zeros.  With a large number of blocks,
     the zeros can actually account for over 99% of a matrix; this
     commonly happens with the kinship matrix for a large collection of
     families (one block/family). The arguments to this routine would
     be block sizes of 2 and 3, along with a 2 by 7 "right hand"
     matrix.  Since the matrix is symmetrical, the bottom slice is not
     needed.

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

     an object of type bdsmatrix

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

     # The matrix shown above is created by
     tmat <- bdsmatrix(c(2,3), c(1,2,1, 3,1,2, 4,3, 5),
                       rmat=matrix(c(4,6,8,1,2,7,6, 5,7,8,1,2,6,9), ncol=2))

     # Note that only the lower part of the blocks is needed, however, the
     #  entire block set is also allowed, i.e., c(1,2,2,1, 3,1,2,1,4,3,2,3,5)

