lrtest: Likelihood Ratio Test for Nested glm_CMP and glm_hP Fits

View source: R/lrtest.R

lrtestR Documentation

Likelihood Ratio Test for Nested glm_CMP and glm_hP Fits

Description

Performs the likelihood ratio chi-squared test to compare nested models.

Usage

lrtest(object1, object2)

Arguments

object1, object2

fitted objects of classes inheriting from "glm_CMP" or "glm_hP"

Details

The test statistics is calculated as 2(llik- llik_0). The test statistics has a chi-squared distribution with r degrees of freedom, where r is the difference in the number of parameters between the full and null models.

Value

A list with class "lrtest" containing the following components:

statistics

the value of the statistic.

df

the degrees of freedom.

p-value

the p-value for the test.

Examples

Bids$size.sq <- Bids$size ^ 2

## Fit null model
fit0 <- glm.hP(formula.mu = numbids ~ leglrest + rearest + finrest +
              whtknght + bidprem + insthold + size + size.sq + regulatn,
              formula.gamma = numbids ~ 1, data = Bids)

## Fit full model
fit <- glm.hP(formula.mu = numbids ~ leglrest + rearest + finrest +
              whtknght + bidprem + insthold + size + size.sq + regulatn,
              formula.gamma = numbids ~ leglrest, data = Bids)

## Likelihood ratio test for the nested models
lrtest(fit,fit0)

DGLMExtPois documentation built on Sept. 4, 2023, 5:06 p.m.