Learn R Programming

glmtoolbox (version 0.1.12)

anova.gnm: Comparison of nested models in Generalized Nonlinear Models.

Description

Allows to use the likelihood-ratio test to compare nested models in generalized nonlinear models.

Usage

# S3 method for gnm
anova(object, ..., verbose = TRUE)

Value

A matrix with the following three columns:

ChiThe value of the statistic of the test,
DfThe number of degrees of freedom,
Pr(>Chi)The p-value of the test-type test computed using the Chi-square distribution.

Arguments

object

an object of the class gnm.

...

another objects of the class gnm.

verbose

an (optional) logical indicating if should the report of results be printed. As default, verbose is set to TRUE.

Examples

Run this code
###### Example: The effects of fertilizers on coastal Bermuda grass
data(Grass)
fit1 <- gnm(Yield ~ b0 + b1/(Nitrogen + a1) + b2/(Phosphorus + a2) + b3/(Potassium + a3),
            family=gaussian(inverse), start=c(b0=0.1,b1=13,b2=1,b3=1,a1=45,a2=15,a3=30), data=Grass)

fit2 <- update(fit1,Yield ~ I(b0 + b2/(Phosphorus + a2) + b3/(Potassium + a3)),
               start=c(b0=0.1,b2=1,b3=1,a2=15,a3=30))

anova(fit2,fit1)

Run the code above in your browser using DataLab