anova.cvam: Comparing the Fit of Two or More Models

anova.cvamR Documentation

Comparing the Fit of Two or More Models

Description

Compares the fit of two or more cvam objects

Usage

## S3 method for class 'cvam'
anova(object, ..., method = c("lrt", "logP", "AIC", "BIC"),
   pval = FALSE, pvalDigits = 4L, showRank=NULL )

Arguments

object

an object produced by cvam

...

additional cvam objects

method

criterion for model comparison: "lrt" uses -2 times the loglikelihood function for a standard likelihood-ratio test; "logP" uses -2 times the penalized loglikelihood or log-posterior density; "AIC" uses Akaike information criterion; and "BIC" uses Bayesian information criterion.

pval

if TRUE then p-values will be computed if method is "lrt" or "logP".

pvalDigits

digits for rounding of p-values

showRank

if TRUE, models will be ranked from best to worst (with rank 1 being the best) according to the fit measure specified by method. Defaults to TRUE if method is "AIC" or "BIC"

Details

The p-values reported for the "lrt" and "logP" methods use a standard chi-squared approximation, with degrees of freedom equal to the difference in the number of parameters for the models being compared. This approximation is valid only if the models being compared are properly nested and ordered, with the simplest model appearing first in the argument list. The chi-squared approximation can be poor if the degrees of freedom for the comparison is large, and if the model corresponding to the null hypothesis (i.e., the smaller one) has fitted cell means that are too small. The chi-squared approximation is not appropriate for comparing latent-class models with a different number of latent classes.

The likelihood function used in "lrt" and "logP" is based on a Poisson model for the cell means in the complete-data table. The Poisson model is an appropriate surrogate for a multinomial model. It is also an appropriate surrogate for a product multinomial if the model includes all possible associations among variables regarded as fixed.

The residual degrees of freedom are the difference between the number of free parameters in a saturated Poisson model minus the number of free parameters in the current Poisson model. The saturated model estimates one parameter for every cell in the complete-data table, excluding dimensions for latent factors, and excluding structural-zero cells. No adjustments are made for estimates on a boundary of the parameter space.

For "BIC", the sample size is taken to be the total number of observations or total frequency in the data supplied by the user to fit the model, which does not include a flattening constant or any nuggets from a prior distribution created by cvamPrior. No adjustments are made for missing or coarsened values.

Value

an object of class c("anova","data.frame")

Author(s)

Joe Schafer Joseph.L.Schafer@census.gov

References

For more information, refer to the package vignette Log-Linear Modeling with Missing and Coarsened Values Using the cvam Package.

See Also

cvam

Examples

M0 <- cvam( ~ V1 + V2, data=crime, freq=n )
M1 <- cvam( ~ V1 * V2, data=crime, freq=n )
anova(M0, M1, pval=TRUE)

cvam documentation built on March 7, 2023, 5:29 p.m.