Skip to contents

Performs the Lo-Mendell-Rubin (LMR) likelihood ratio test to compare a k-class model against a (k-1)-class model. This is an asymptotic approximation that is faster than the bootstrap LRT (BLRT).

Usage

lmr_test(model_k, model_k1, adjusted = TRUE)

Arguments

model_k

Fitted SurveyMixr object with k classes

model_k1

Fitted SurveyMixr object with k-1 classes

adjusted

Logical; if TRUE (default), uses the adjusted LMR (aLMR) which provides better finite-sample performance

Value

A list of class lmr_test with components:

statistic

LMR test statistic

statistic_adjusted

Adjusted LMR statistic (if adjusted = TRUE)

df

Degrees of freedom

p_value

p-value from asymptotic distribution

p_value_adjusted

Adjusted p-value (if adjusted = TRUE)

loglik_k

Log-likelihood for k-class model

loglik_k1

Log-likelihood for (k-1)-class model

n_params_k

Number of parameters in k-class model

n_params_k1

Number of parameters in (k-1)-class model

sample_size

Effective sample size

conclusion

Text interpretation of result

Details

The LMR test (Lo, Mendell, & Rubin, 2001) tests the null hypothesis that k-1 classes are sufficient against the alternative of k classes. The test statistic is:

$$LRT = -2(\log L_{k-1} - \log L_k)$$

Under regularity conditions, this follows an asymptotic distribution that can be approximated. The adjusted LMR (aLMR) applies a scaling correction for better finite-sample performance:

$$aLMR = LMR \times c$$

where c is a scaling factor based on sample size and model complexity.

**Advantages over BLRT:** - Much faster (no bootstrap resampling) - Asymptotic approximation - Good performance in large samples

**Disadvantages:** - Less accurate than BLRT in small samples - Relies on asymptotic theory - May be anti-conservative

References

Lo, Y., Mendell, N. R., & Rubin, D. B. (2001). Testing the number of components in a normal mixture. *Biometrika*, 88(3), 767-778.

Nylund, K. L., Asparouhov, T., & Muthén, B. O. (2007). Deciding on the number of classes in latent class analysis and growth mixture modeling: A Monte Carlo simulation study. *Structural Equation Modeling*, 14(4), 535-569.

Examples

if (FALSE) { # \dontrun{
# Full example (slow - use for actual analysis):
data(mcs_simulated)

# Fit 2-class and 3-class models
fit2 <- gmm_survey(
  data = mcs_simulated,
  id = "id", time = "age", outcome = "selfcontrol",
  n_classes = 2, starts = 100
)

fit3 <- gmm_survey(
  data = mcs_simulated,
  id = "id", time = "age", outcome = "selfcontrol",
  n_classes = 3, starts = 100
)

# LMR test: Is 3-class better than 2-class?
lmr_result <- lmr_test(fit3, fit2)
print(lmr_result)

# Adjusted LMR (recommended)
almr_result <- lmr_test(fit3, fit2, adjusted = TRUE)
print(almr_result)
} # }