sandcov              package:haplo.ccs              R Documentation

_C_o_m_p_u_t_e _S_a_n_d_w_i_c_h _V_a_r_i_a_n_c_e-_C_o_v_a_r_i_a_n_c_e _E_s_t_i_m_a_t_e_s

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

     'sandcov' computes sandwich variance-covariance estimates for the
     coefficients of a fitted model. These estimates may be used to
     calculate robust standard error estimates.

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

     sandcov(model, id)

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

   model: a fitted model of class '"lm"' or '"glm"'.

      id: the numeric vector used to identify subjects, expanded for
          each subject by the number of observations for that subject.

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

     For a model of class '"haplo.ccs"', the sandwich
     variance-covariance matrix is automatically provided as the object
     'covariance', or may be extracted by 'vcov' (i.e.,
     'vcov.haplo.ccs'). See examples below.

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

     A named matrix for the covariance of the regression coefficients
     specified in 'model', calculated using the sandwich method.

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

     Benjamin French and Thomas Lumley, University of Washington

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

     French B, Lumley T, Monks SA, Rice KM, Hindorff LA, Reiner AP,
     Psaty BM. Simple estimates of haplotype relative risks in
     case-control data. Genetic Epidemiology 2006; 30(6):485-494.

     Liang KY, Zeger SL. Longitudinal data analysis using generalized
     linear models. Biometrika 1986; 73(1):13-22.

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

     'glm', 'haplo.ccs', 'lm'

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

     data(renin)

     ## Fit a model for covariate effects.

     m1 <- glm(case ~ age + factor(race) + gender, family=binomial(link=logit))

     ## Obtain sandwich variance-covariance matrix.

     id <- 1:length(case)
     v1 <- sandcov(model = m1, id = id)

     ## Calculate robust standard error estimates.

     se1 <- sqrt(diag(v1))

     ## Fit a model for haplotype and covariate effects.

     m2 <- haplo.ccs(case ~ gender + age + factor(race) + haplo(geno))

     ## Obtain sandwich variance-covariance matrix by one of two methods.

     v2 <- m2$covariance
     v2 <- vcov(m2)

     ## Calculate robust standard error estimates.

     se2 <- sqrt(diag(v2))

