Log-posterior Density for Conditional Gaussian Models

DESCRIPTION:

Calculates the observed-data log-likelihood or log-posterior for incomplete data modeled by a conditional Gaussian model, with a Dirichlet prior on the loglinear parameters.

USAGE:

logpost.cgm(object, theta = <<see below>>, prior = 1) 

REQUIRED ARGUMENTS:

object
an object of class "missmodel" whose parameters component is of class "cgm". I.e., an object resulting from the use of the mdCgm, daCgm, or emCgm functions. Alternatively, a class "preCgm" object.

OPTIONAL ARGUMENTS:

theta
the model parameters. If not specified, these are obtained as the final estimates (the last row) in the paramIter component of the input missmodel object. If a class "preCgm" object is input, the model parameters must be specified exactly as in a class "cgm" object (see ).

This may be a "cgm" object with multiple rows; then calculations are performed for each row, and a vector is returned.
prior
Gives the hyperparameters of the Dirichlet prior distribution assumed for the loglinear part of the model.

Supply either a character string, or an object of class "priorLoglin", or a vector of hyperparameters. The vectors length equals the number of cells formed by the factors modeled by a loglinear model.

Valid character strings are "ml" (maximum likelihood), "noninformative", and "data.dependent". String matching is used, so the characters "m", "n", or "d" are sufficient. The values of the hyperparameters change with the algorithm (see for details). E.g. "noninformative" means a common value of 1 for EM, and a common value of 0.5 for DA. A data dependent prior (following an independence model) can also be generated using routine dataDepPrior. See for details.

A class "priorLoglin" object is created by routine priorLoglin. This routine allows you to easily specify data dependent priors.

The cells in the contingency table are ordered such that the levels of the first variable defining the table varies fastest, the second variable levels vary next fastest, etc. If a single numeric value is input, its value is replicated for all cells in the table.

The default value is "noninformative". When a class "missmodel" object is input, any value specified in a previous call has priority over the default value (but not over any currently specified value).

Structural zeros must be coded as missing ( NA) when a vector of hyperparameters is input as argument prior.

If a class "missmodel" object is input and argument prior is not given, then argument prior defaults to the prior probabilities specified in the call statement of the input "missmodel" object. If these are not specified, then the default (which depends on the algorithm) is used.

VALUE:

the value of the observed-data log-likelihood or log-posterior density function evaluated at theta.

DETAILS:

This is the log-likelihood or log-posterior density that ignores the missing-data mechanism.

SEE ALSO:

, , , , , .

EXAMPLES:

fit <- emCgm(object = stlouis[,-1], margins = ~D1:D2+risk, 
             gauss = ~verbal1+verbal2, design = ~D1+D2+risk, 
             subset = verbal2 > 100 | is.na(verbal2)) 
logpost(fit) 
logpost.cgm(fit)   #same