lrtest  R Documentation 
lrtest
is a generic function for carrying out likelihood ratio tests.
The default method can be employed for comparing nested (generalized)
linear models (see details below).
lrtest(object, ...) ## Default S3 method: lrtest(object, ..., name = NULL) ## S3 method for class 'formula' lrtest(object, ..., data = list())
object 
an object. See below for details. 
... 
further object specifications passed to methods. See below for details. 
name 
a function for extracting a suitable name/description from
a fitted model object. By default the name is queried by calling

data 
a data frame containing the variables in the model. 
lrtest
is intended to be a generic function for comparisons
of models via asymptotic likelihood ratio tests. The default method consecutively compares
the fitted model object object
with the models passed in ...
.
Instead of passing the fitted model objects in ...
, several other
specifications are possible. The updating mechanism is the same as for waldtest
:
the models in ...
can be specified as integers, characters
(both for terms that should be eliminated from the previous model), update formulas or
fitted model objects. Except for the last case, the existence of an update
method is assumed. See waldtest
for details.
Subsequently, an asymptotic likelihood ratio test for each two consecutive models is carried out:
Twice the difference in loglikelihoods (as derived by the logLik
methods)
is compared with a Chisquared distribution.
The "formula"
method fits a lm
first and then calls the default
method.
An object of class "anova"
which contains the loglikelihood, degrees of freedom,
the difference in degrees of freedom, likelihood ratio Chisquared statistic and corresponding p value.
waldtest
## with data from Greene (1993): ## load data and compute lags data("USDistLag") usdl < na.contiguous(cbind(USDistLag, lag(USDistLag, k = 1))) colnames(usdl) < c("con", "gnp", "con1", "gnp1") fm1 < lm(con ~ gnp + gnp1, data = usdl) fm2 < lm(con ~ gnp + con1 + gnp1, data = usdl) ## various equivalent specifications of the LR test lrtest(fm2, fm1) lrtest(fm2, 2) lrtest(fm2, "con1") lrtest(fm2, . ~ .  con1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.