Learn R Programming

SciencesPo (version 1.02.12)

lrtest: Likelihood Ratio Test (LRT)

Description

Computes the likelihood ratio test (LRT)--a goodness-of-fit--between two nested models. It checks the difference in the deviance (-2*logLikelihood) between the two candidate models against the change in degrees of freedom using a chi-squared test.

Usage

lrtest(model1, model2)

Arguments

model1
the first model object.
model2
the second model object.

Details

LR = -2 ln(L(m1)/L(m2)) = 2(ll(m2)-ll(m1))

Examples

Run this code
data(titanic)
mod0 <- glm( SURVIVED ~ CLASS, family=binomial, data=titanic)
mod1 <- glm( SURVIVED ~ CLASS + SEX, family=binomial, data=titanic)

lrtest(mod0, mod1)

Run the code above in your browser using DataLab