Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

lrtest

Likelihood ratio test


Description

Likelihood ratio test for objects of class 'glm'

Usage

lrtest (model1, model2)

Arguments

model1, model2

Two models of class "glm" having the same set of records and the same type ('family' and 'link')

Details

Likelihood ratio test checks the difference between -2*logLikelihood of the two models against the change in degrees of freedom using a chi-squared test. It is best applied to a model from 'glm' to test the effect of a factor with more than two levels. The records used in the dataset for both models MUST be the same. The function can also be used with "clogit", which does not have real logLikelihood.

Author(s)

Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>

See Also

'glm', 'logLik', 'deviance'

Examples

model0 <- glm(case ~ induced + spontaneous, family=binomial, data=infert)
model1 <- glm(case ~ induced, family=binomial, data=infert)
lrtest (model0, model1)
lrtest (model1, model0) # same result
lrtest (model1, model0) -> a
a

epiDisplay

Epidemiological Data Display Package

v3.5.0.1
GPL (>= 2)
Authors
Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>
Initial release
2018-05-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.