Learn R Programming

secr (version 5.0.0)

LR.test: Likelihood Ratio Test

Description

Compute likelihood ratio test to compare two fitted models, one nested within the other.

Usage

LR.test(model1, model2)

Value

Object of class `htest', a list with components

statistic

value the test statistic

parameter

degrees of freedom of the approximate chi-squared distribution of the test statistic

p.value

probability of test statistic assuming chi-square distribution

method

character string indicating the type of test performed

data.name

character string with names of models compared

Arguments

model1

fitted model

model2

fitted model

Details

The fitted models must be of a class for which there is a logLik method (e.g., `secr' or `lm'). Check with methods("logLik").

The models must be nested (no check is performed - this is up to the user), but either model1 or model2 may be the more general model.

The models must also be compatible by the criteria of AICcompatible.

The test statistic is twice the difference of the maximized likelihoods. It is compared to a chi-square distribution with df equal to the number of extra parameters in the more complex model.

See Also

AICcompatible, AIC.secr, score.test

Examples

Run this code

## two pre-fitted models
AIC (secrdemo.0, secrdemo.b)
LR.test  (secrdemo.0, secrdemo.b)

Run the code above in your browser using DataLab