alrt function

Function to compute asymptotic likelihood ratio test of two models.

Function to compute asymptotic likelihood ratio test of two models.

This function computes the asymptotic likelihood ratio test of two models by comparing twice the different in the log-likelihoods of the models with the Chi-squared distribution with degrees of freedom equal to the difference in the degrees of freedom of the models.

alrt(x1, x2, boundary = FALSE)

Arguments

  • x1: A fitted model as an object that logLik will work for.
  • x2: A fitted model as an object that logLik will work for.
  • boundary: A flag that reports whether a boundary correction should be made.

Returns

  • out.tab: A data frame that summarizes the test.

  • jll.diff: The difference between the log-likelihoods.

  • df.diff: The difference between the degrees of freedom.

  • p.value: The p-value of the statistical test of the null hypothesis that there is no difference between the fit of the models.

References

Hilbe, J.M., and Robinson, A.P. 2013. Methods of Statistical Model Estimation. Chapman & Hall / CRC.

Author(s)

Andrew Robinson and Joe Hilbe.

Note

The function does not provide any checks for nesting, data equivalence, etc.

See Also

ml_glm, ml_glm2

Examples

data(medpar) ml.poi.1 <- ml_glm(los ~ hmo + white, family = "poisson", link = "log", data = medpar) ml.poi.2 <- ml_glm(los ~ hmo, family = "poisson", link = "log", data = medpar) alrt(ml.poi.1, ml.poi.2)
  • Maintainer: Andrew Robinson
  • License: GPL-3
  • Last published: 2018-03-18

Useful links