Skip to contents

Tests whether a fitted model reproduces the item-pair cross tables. The reference point is the saturated model of the first- and second-order margins, not of the full response-pattern table, so no benchmark log-likelihood is required. That is what makes the statistic usable for nominal data, where nearly every response pattern is unique and the full-information chi-square does not follow its nominal distribution (Collins et al., 1993).

The analogy that usually lands: the chi-square of a structural equation model does not test the whole multivariate distribution, only whether the model reproduces the covariance matrix. \(M_2\) is the categorical counterpart, with the cross tables in place of the covariance matrix.

Usage

M2(x, ...)

# Default S3 method
M2(x, ...)

# S3 method for class 'nominalLCA'
M2(x, verbose = TRUE, gc = TRUE, ...)

# S3 method for class 'ratedLCA'
M2(x, verbose = TRUE, gc = TRUE, ...)

# S3 method for class 'ordinalBiclustering'
M2(x, verbose = TRUE, gc = TRUE, ...)

# S3 method for class 'nominalBiclustering'
M2(x, verbose = TRUE, gc = TRUE, ...)

# S3 method for class 'LRAordinal'
M2(x, verbose = TRUE, gc = TRUE, ...)

Arguments

x

A fitted model object of class "exametrika".

...

Additional arguments passed to methods.

verbose

Logical; if TRUE (default), reports the size of the margin covariance matrix before computing it when that matrix is large.

gc

Logical; if TRUE (default), releases the workspace back to the operating system before returning. The margin covariance and its Cholesky factor are the largest objects the package ever allocates – gigabytes for a long test – and R holds on to that block otherwise. Interactive use, where this is called once per model, wants it. A loop over many fits does not: the collection costs a noticeable fraction of the computation and buys nothing, since the next call allocates the same block again. Pass FALSE there.

Value

An object of class "exametrika" and "M2" containing:

M2

The statistic.

df

Degrees of freedom, m - rank(Delta). Note that this is not m - n_param: see rank_delta.

p

Upper tail probability of the chi-square distribution with df degrees of freedom.

m

Number of margins used: the free categories of every item, plus one entry for each combination of a free category of one item with a free category of another.

n_param

Number of model parameters, ncls * sum(ncat - 1) (for a Biclustering, one set per field instead of per item). The class proportions are fixed at 1/C and not counted, except for a Biclustering fitted with mixing = "estimate", where the ncls - 1 free weights are added (since 2.3.0).

rank_delta

Rank of the Jacobian. For ncls >= 3 it falls short of n_param by (ncls - 1)(ncls - 2) / 2 in an LCA, because the second-order margins determine the class deviations only through their Gram matrix, which is invariant to rotations of the class space. With shared field profiles and with estimated weights the shortfall is different; it is always computed, never assumed.

Details

The statistic is interpretable only when the estimator is the maximum likelihood estimator of the fitted model, since the asymptotics require the margin residual to be orthogonal to the Jacobian. That holds for LCA.nominal and LCA.rated, which are fitted by EM. It does not hold for filter-based estimation (GTM), which is a regularisation rather than a maximum likelihood estimator, nor for order-restricted estimation, whose limiting distribution is a mixture of chi-squares rather than a single one.

A Biclustering fitted with mixing = "estimate" uses the estimated class weights in the margins and counts them as parameters. Under data generated from such a model with unequal weights, the statistic of the plain Biclustering (method = "B") followed its chi-square reference in simulation (500 replications: mean 117.0 against 117 degrees of freedom, 6.0 percent rejected at the 5 percent level; 300 replications of a larger design: mean 593.7 against 597, 3.3 percent). The weights do not raise rank_delta – up to second-order margins a change of the weights can be absorbed by the profiles – so the degrees of freedom are those of the fixed-weight fit, and the statistic does not detect weights wrongly fixed at 1/C.

The degrees of freedom here are orders of magnitude smaller than in a full-information test, so an RMSEA computed from \(M_2\) is not comparable with a full-information RMSEA and the conventional cutoffs do not carry over.

Cost: the margin covariance is a dense m x m matrix and the Cholesky factorisation dominates. With 20 items and 5 categories m is 3,120 (74 MB, well under a second); with 50 items it is 19,800 (2.9 GB, around 20 seconds). A message reports the size before the work starts when m is large.

References

Maydeu-Olivares, A., & Joe, H. (2005). Limited- and full-information estimation and goodness-of-fit testing in 2^n contingency tables: A unified framework. Journal of the American Statistical Association, 100(471), 1009-1020.

Maydeu-Olivares, A., & Joe, H. (2006). Limited information goodness-of-fit testing in multidimensional contingency tables. Psychometrika, 71(4), 713-732.

Collins, L. M., Fidler, P. L., Wugalter, S. E., & Long, J. D. (1993). Goodness-of-fit testing for latent class models. Multivariate Behavioral Research, 28(3), 375-389.

Examples

# \donttest{
dat <- dataFormat(J20S600, response.type = "nominal")
fit <- LCA(dat, ncls = 3)
M2(fit)
#> Limited-information goodness-of-fit (M2)
#> M2 = 3506.201, df = 1591, p = 0.0000
#> margins = 1770, parameters = 180, rank of Jacobian = 179
#>   (the Jacobian is 1 short of the parameter count: the class space can be rotated
#>    without changing the margins, so df counts the rank, not the parameters)
# }