getVarCov                package:nlme                R Documentation

_E_x_t_r_a_c_t _v_a_r_i_a_n_c_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:

     Extract the variance-covariance matrix from a fitted model, such
     as a mixed-effects model.

_U_s_a_g_e:

     getVarCov(obj, ...)
     ## S3 method for class 'lme':
     getVarCov(obj, individuals,
         type = c("random.effects", "conditional", "marginal"), ...)
     ## S3 method for class 'gls':
     getVarCov(obj, individual = 1, ...)

_A_r_g_u_m_e_n_t_s:

     obj: A fitted model.  Methods are available for models fit by
          'lme' and by 'gls'

individuals: For models fit by 'lme' a vector of levels of the grouping
          factor can be specified for the conditional or marginal
          variance-covariance matrices.

individual: For models fit by 'gls' the only type of
          variance-covariance matrix provided is the marginal
          variance-covariance of the responses by group.  The optional
          argument 'individual' specifies the group of responses.

    type: For models fit by 'lme' the 'type' argument specifies the
          type of variance-covariance matrix, either '"random.effects"'
          for the random-effects variance-covariance (the default), or
          '"conditional"' for the conditional. variance-covariance of
          the responses or '"marginal"' for the the marginal
          variance-covariance of the responses.

     ...: Optional arguments for some methods, as described above

_V_a_l_u_e:

     A variance-covariance matrix or a list of variance-covariance
     matrices.

_A_u_t_h_o_r(_s):

     Mary Lindstrom lindstro@biostat.wisc.edu

_S_e_e _A_l_s_o:

     'lme', 'gls'

_E_x_a_m_p_l_e_s:

     fm1 <- lme(distance ~ age, data = Orthodont, subset = Sex == "Female")
     getVarCov(fm1)
     getVarCov(fm1, individual = "F01", type = "marginal")
     getVarCov(fm1, type = "conditional")
     fm2 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
                correlation = corAR1(form = ~ 1 | Mare))
     getVarCov(fm2)

