

   MMaarrggiinnaall pprroobbaabbiilliittiieess ffoorr ccaatteeggoorriiccaall rreeppeeaatteedd mmeeaassuurreess
   wwiitthh mmiissssiinngg ddaattaa

        catmiss(response, frequency, ccov=NULL)

   AArrgguummeenntts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'.

   DDeessccrriippttiioon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.)

   VVaalluuee::

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

   AAuutthhoorr((ss))::

        J.K. Lindsey

   SSeeee AAllssoo::

        `glm', `nordr'

   EExxaammppllees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])

