Finds ML estimate or posterior mode of cell probabilities under the saturated multinomial model.
em.cat(s, start, prior=1, showits=TRUE, maxits=1000,
eps=0.0001)
array of dimension s$d
containing the ML estimate or posterior mode,
assuming that EM has converged by maxits
iterations.
summary list of an incomplete categorical dataset produced by
the function prelim.cat
.
optional starting value of the parameter. This is an array with
dimensions s$d
whose elements sum to one. The default starting value
is a uniform array (equal probabilities in all cells). If structural
zeros appear in the table, start
should contain zeros in those
positions and nonzero (e.g. uniform) values elsewhere.
optional vector of hyperparameters for a Dirichlet prior distribution.
The default is a uniform prior distribution (all hyperparameters = 1)
on the cell probabilities, which will result in maximum likelihood
estimation. If structural zeros appear in the table, a prior should be
supplied with NA
s in those cells.
if TRUE
, reports the iterations of EM so the user can monitor
the progress of the algorithm.
maximum number of iterations performed. The algorithm will stop if the parameter still has not converged after this many iterations.
convergence criterion. This is the largest proportional change in an expected cell count from one iteration to the next. Any expected cell count that drops below 1E-07 times the average cell probability (1/number of non-structural zero cells) is set to zero during the iterations.
Schafer (1996) Analysis of Incomplete Multivariate Data. Chapman & Hall, Section 7.3.
prelim.cat
, ecm.cat
, logpost.cat
data(crimes)
crimes
s <- prelim.cat(crimes[,1:2],crimes[,3]) # preliminary manipulations
thetahat <- em.cat(s) # mle under saturated model
logpost.cat(s,thetahat) # loglikelihood at thetahat
Run the code above in your browser using DataLab