

catmiss(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_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 esti-
     mates 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, indi-
          cated 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 cor-
          responding 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 `fre-
          quency'. 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(codes(r1), codes(r2), codes(r3))[1:26,]
     resp <- ifelse(resp==3, NA, resp)
     catmiss(resp, y[1:26])

