Description Usage Arguments Details Value References Examples
Performs the Breusch-Pagan test against heteroskedasticity. This function is exported from the "lmtest" package (Achim Zeileis & Torsten Hothorn, 2002). This function provides a way to test the heteroskedasticity identification condition (5) in Lemma 1 of Tchetgen Tchetgen et al. (2017).
1 |
formula |
a symbolic description for the model to be tested (or a fitted |
varformula |
a formula describing only the potential explanatory variables for the variance (no dependent variable needed). By default the same explanatory variables are taken as in the main regression model. |
studentize |
logical. If set to |
data |
an optional data frame containing the variables in the model. By default the variables are taken from the environment which |
The Breusch-Pagan test fits a linear regression model to the residuals
of a linear regression model (by default the same explanatory variables are taken as in the main regression
model) and rejects if too much of the variance is explained by the additional explanatory variables. Under H0 the test statistic of the Breusch-Pagan test follows a
chi-squared distribution with parameter
(the number of regressors without the constant in the model) degrees of freedom.
A list with class "htest"
containing the following components:
statistic |
the value of the test statistic. |
p.value |
the p-value of the test. |
parameter |
degrees of freedom. |
method |
a character string indicating what type of test was performed. |
data.name |
a character string giving the name(s) of the data. |
T.S. Breusch & A.R. Pagan (1979), A Simple Test for Heteroscedasticity and Random Coefficient Variation. Econometrica 47, 1287–1294
R. Koenker (1981), A Note on Studentizing a Test for Heteroscedasticity. Journal of Econometrics 17, 107–112.
W. Kramer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica
Achim Zeileis & Torsten Hothorn (2002), Diagnostic Checking in Regression Relationships. R News 2(3), 7-10. https://CRAN.R-project.org/doc/Rnews/
Tchetgen Tchetgen, E., Sun, B. and Walter, S. (2017). The GENIUS Approach to Robust Mendelian Randomization Inference. arXiv e-prints.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # the following packages are needed to simulate data
library("msm")
library("MASS")
nIV=10; N=500; beta=1;
phi=rep(-0.5,nIV); gamma=rep(-2,nIV); alpha=rep(-0.5,nIV);
lambda0=1; lambda1=rep(0.5,nIV);
Gn = mvrnorm(N,rep(0,nIV),diag(rep(1,nIV)))
G = (Gn>0)*1;
U = as.vector(phi%*%t(G))+rnorm(N);
A = as.vector(gamma%*%t(G)) +U + rnorm(N,mean=0,sd=abs(lambda0+as.vector(lambda1%*%t(G))));
Y = as.vector(alpha%*%t(G)) + beta*A + U + rnorm(N);
bptest(A~G);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.