lrtest: Likelihood Ratio Test for Nested glm_CMP and glm_hP Fits

Description Usage Arguments Details Value Examples

View source: R/lrtest.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 Aug. 1, 2019, 5:07 p.m.