bdsBlock               package:kinship               R Documentation

_B_l_o_c_k _d_i_a_g_o_n_a_l _m_a_t_r_i_c_e_s.

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

     Create a block-diagonal matrix of ones.

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

     bdsBlock(id, group)

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

      id: the identifier list.   This will become the dimnames of the
          final matrix, and must be a  set of unique values. It's
          length determines the dimension of the final matrix 

   group: a vector giving the grouping structure. All rows/cols
          belonging to a given group will form a block of  1's in the
          final matrix. 

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

     a block-diagonal matrix of class 'bdsmatrix'

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

     'bdsmatrix, bdsI'

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

     ## Not run: 
     id    <- letters[1:10]
     group <- c(1,1,3,2,3,3,2,3,2,4)
     bdsBlock(id, group)
         a b d g i c e f h j 
       a 1 1 0 0 0 0 0 0 0 0
       b 1 1 0 0 0 0 0 0 0 0
       d 0 0 1 1 1 0 0 0 0 0
       g 0 0 1 1 1 0 0 0 0 0
       i 0 0 1 1 1 0 0 0 0 0
       c 0 0 0 0 0 1 1 1 1 0
       e 0 0 0 0 0 1 1 1 1 0
       f 0 0 0 0 0 1 1 1 1 0
       h 0 0 0 0 0 1 1 1 1 0
       j 0 0 0 0 0 0 0 0 0 1

     # Create the matrices for a sparse nested fit of family within city
     group <- paste(mydata$city, mydata$family, sep='/')
     mat1 <- bdsI(group)
     mat2 <- bdsBlock(group, mydata$city)
     fit <- coxme(Surv(time, status) ~ age + sex, data=mydata,
                    random= ~1|group, varlist=list(mat1, mat2))
     ## End(Not run)

