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

vdtest.lm

Test for Varying Dispersion Parameter in Normal Linear Models


Description

Performs Rao's score test for varying dispersion parameter in weighted and unweighted normal linear models.

Usage

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

Arguments

model

an object of the class lm which is obtained from the fit of a weighted or unweighted normal linear model.

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

If the object model corresponds to an unweighted normal linear model then this test assess the assumption of constant variance, which coincides with the (non-studentized) Breusch-Pagan test against heteroskedasticity.

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

Breusch T.S. and Pagan A.R. (1979) A simple test for heteroscedasticity and random coefficient variation. Econometrica 47, 1287–1294.

Cook R.D. and Weisberg S. (1983) Diagnostics for heteroscedasticity in regression. Biometrika 70, 1–10.

See Also

Examples

## Example 1
fit1 <- lm(mpg ~ log(hp) + log(wt), data=mtcars)
vdtest(fit1)

## Example 2
fit2 <- lm(Species ~ Biomass + pH, data=richness)
vdtest(fit2)

fit2a <- lm(Species ~ Biomass + pH, data=richness, subset=-c(1,3,18,20))
vdtest(fit2a)

## Example 3
whiteside <- MASS::whiteside
fit3 <- lm(Gas ~ Temp + Insul + Temp*Insul, data=whiteside)
vdtest(fit3)

fit3a <- lm(Gas ~ Temp + Insul + Temp*Insul, data=whiteside, subset=-c(8,9,36,46,55))
vdtest(fit3a)

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.