Learn R Programming

lmtest (version 0.2-2)

bptest: Breusch-Pagan-Test

Description

bptest performs the Breusch-Pagan-Test against heteroskedasticity.

Usage

bptest(formula, data=list())

Arguments

formula
a symbolic describtion for the model to be tested
data
an optional data frame containing the variables in the model. By default the variables are taken from the environment which 'bptest' is called from

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the test statistic.
  • p.valuethe p-value of the test.
  • methoda character string indicating what type of test was performed.
  • data.namea character string giving the name(s) of the data.

Details

The test statistic under H0 follows a chisq distribution with df degree of freedom.

References

Kraemer, W., Sonnberger, H. (1986): The linear regression model under test

See Also

lm

Examples

Run this code
# generate a regressor
x <- sort(runif(50,-10,10))
# generate heteroskedastic disturbances
err <- c(rnorm(25,0,1),rnorm(25,0,10))
# generate a linear relationship
y <- 2*x + err
# perform Breusch-Pagan
bp <- bptest(y~x-1)
# calculate quantil
qchisq(0.95, bp$parameter[1])

Run the code above in your browser using DataLab