Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vdtest.glm

Test for Varying Dispersion Parameter in Generalized Linear Models


Description

Performs Rao's score test for varying dispersion parameter in weighted and unweighted generalized linear models in which the response distribution is assumed to be gaussian, Gamma or inverse gaussian.

Usage

## S3 method for class 'glm'
vdtest(model, varformula, verbose = TRUE, ...)

Arguments

model

an object of the class glm which is obtained from the fit of a weighted or unweighted generalized linear model in which the response distribution is assumed to be gaussian, Gamma or inverse gaussian.

varformula

an (optional) formula expression of the form ~ predictors describing only the potential explanatory variables for the dispersion. By default, the same explanatory variables are taken as in the model for the mean.

verbose

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

...

further arguments passed to or from other methods.

Details

The aim of this test is to assess the assumption of constant dispersion parameter in generalized linear models. If the object model corresponds to an unweighted generalized linear model then this test assess assumptions of constant variance and constant coefficient of variation on models in which the response distribution is assumed to be gaussian and Gamma, respectively.

Value

A list which includes the three main attributes of the test for varying dispersion parameter: statistic ("statistic"), degrees of freedom ("df") and p-value ("p.value").

References

Wei BC., Shi JQ., Fung WK. and Hu YQ. (1998) Testing for Varying Dispersion in Exponential Family Nonlinear Models. Annals of the Institute of Statistical Mathematics 50, 277–294.

See Also

Examples

## Example 1
Auto <- ISLR::Auto
fit1 <- glm(mpg ~ weight*horsepower, family=inverse.gaussian("log"), data=Auto)
vdtest(fit1)

## Example 2
fit2 <- glm(rtime ~ log(distance) + log(cclimb), family=Gamma("log"), data=races)
vdtest(fit2)

glmtoolbox

Set of Tools to Data Analysis using Generalized Linear Models

v0.1.0
GPL-2 | GPL-3
Authors
Luis Hernando Vanegas [aut, cre], Luz Marina Rondón [aut], Gilberto A. Paula [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.