catmiss               package:repeated               R Documentation

_M_a_r_g_i_n_a_l _P_r_o_b_a_b_i_l_i_t_i_e_s _f_o_r _C_a_t_e_g_o_r_i_c_a_l _R_e_p_e_a_t_e_d _M_e_a_s_u_r_e_m_e_n_t_s _w_i_t_h
_M_i_s_s_i_n_g _D_a_t_a

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

     'catmiss' calculates the marginal probabilities of repeated
     responses. If there are missing values, it gives both the complete
     data estimates and the estimates using all data. It is useful, for
     example, when a log linear model is fitted; the resulting fitted
     values can be supplied to 'catmiss' to obtain the estimates of the
     marginal probabilities for the model. (Note however that the
     standard errors do not take into account the fitting of the
     model.)

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

     catmiss(response, frequency, ccov=NULL)

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

response: A matrix with one column for each of the repeated measures
          and one row for each possible combination of responses,
          including the missing values, indicated by NAs.

frequency: A vector containing the frequencies. Its length must be a
          multiple of the number of rows of 'response'. Responses are
          arranged in blocks corresponding to the various possible
          combinations of values of the explanatory variables.

    ccov: An optional matrix containing the explanatory variables
          (time-constant covariates) as columns, with one line per
          block of responses in 'frequency'. Thus, the number of rows
          of response times the number of rows of 'ccov' equals the
          length of 'frequency'.

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

     A matrix with the probabilities and their standard errors is
     returned.

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

     J.K. Lindsey

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

     'glm', 'nordr'

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

     y <- rpois(27,15)
     r1 <- gl(3,1,27)
     r2 <- gl(3,3,27)
     r3 <- gl(3,9)
     # r1, r2, and r3 are factor variables with 3 indicating missing
     # independence model with three binary repeated measures
     # with missing values
     print(z <- glm(y~r1+r2+r3, family=poisson))
     # obtain marginal estimates (no observations with 3 missing values)
     resp <- cbind(as.integer(r1), as.integer(r2), as.integer(r3))[1:26,]
     resp <- ifelse(resp==3, NA, resp)
     catmiss(resp, y[1:26])

