EM Algorithm for Log-Linear Models

DESCRIPTION:

Computes EM algorithm estimates for log-linear models.

This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes which already have methods for this function include: preLoglin and missmodel. A default method operates on matrices and data frames.

USAGE:

emLoglin(object, ...) 

REQUIRED ARGUMENTS:

object
a matrix, data frame, or object of class "preLoglin" or "missmodel".

OPTIONAL ARGUMENTS:

...
most methods have additional arguments margins, prior, start, and control which affect the EM algorithm. Additional arguments are possible. See the specific function called for a list of all possible arguments.

VALUE:

an object of class "missmodel" is returned; see for further details.

DETAILS:

The emLoglin function computes estimates of the cell probabilities in hierarchical log-linear models. A hierarchical log-linear model is a multinomial model that predicts the log of the cell probabilities for the multinomial as a linear factorial model. In hierarchical models the inclusion of an interaction effect automatically means that all dependent lower level effects are included in the model. For example, for factors A , B, and C, inclusion of A:B:C automatically means that A , B, C, A:B, A:C , and B:C are also included in the model.

emLoglin handles missing values by using the EM algorithm to compute the modes of the posterior probability distribution of the estimates given the specifed Dirichlet prior (when all Dirichlet parameters are one, maximum likelihood estimates are computed).

Given the results from the EM algorithm, missing values can be imputed with the impLoglin function.

Because the emLoglin function is often called more than once, it is usually preferable to precompute quantities used by emLoglin . This may be done using the preLoglin function.

REFERENCES:

Agresti, A. (1990), Categorical Data Analysis , John Wiley & Sons, New York.

Bishop, Y. M. M., Fienberg, S. E., and Holland, H. W., Discrete Multivariate Analysis: Theory and Practice , MIT Press, Cambridge.

Schafer, J. L. (1997), Analysis of Incomplete Multivariate Data , Chapman & Hall, London.

SEE ALSO:

, , , , , .

EXAMPLES:

emLoglin(object = crime, margins = count~Visit.1:Visit.2) 
emLoglin.default(object = crime, margins = count~Visit.1:Visit.2)    #same 
crime.p <- preLoglin(data = crime, margins = count~Visit.1:Visit.2) 
crime.em <- emLoglin(crime.p, margins = ~Visit.1+Visit.2) 
emLoglin.preLoglin(crime.p, margins = ~Visit.1+Visit.2)              #same 
emLoglin(crime.em, margins = list(1,2), start = c(1,1,1,1)) 
emLoglin.missmodel(crime.em, margins = list(1,2), start = c(1,1,1,1))  #same