I am trying to estimate heteroskedasticity in R. I had Eviews available in my college's lab but not at home. I have been trying to use "het.test" package and whites.htest but the value that I get is different from what I get in Eviews. According to the author of the package, it is meant to do the same test as is done in Eviews.

My model looks like A~B+C. Kindly guide me what I am doing wrong.

I 1st run ols for equation A~B+C, after getting results, I clicked View>Residual diagnostics>Heteroscadicity tests>White's (with Include white cross terms) and then Press ok. The result i got was Prob. F(5,27) = 0.2948.

For R, i tried code at this link [this link][1], here is the edited code that i used.

dataset <- data.frame(A,B,C)) 
model1 <- VAR(dataset, p = 1) 

This gave me value of 0.63.

I tried searching this forum but none question seemed related. I am not a programmer not statistician so please pardon my ignorance.

  • 3
    $\begingroup$ It is going to be hard to say without more information. Can you paste in the code & output from the 3 tests? Can you say more about your data & your model? Etc. $\endgroup$ – gung - Reinstate Monica Jun 4 '15 at 12:58
  • $\begingroup$ @gung, please see as i have added details. $\endgroup$ – Faseeh Jun 4 '15 at 17:52
  • $\begingroup$ Why not lm? Why VAR? $\endgroup$ – tchakravarty Jun 4 '15 at 17:53
  • $\begingroup$ @T C..Thank you for reply.. i must say, it was there in the code that i quoted, :( can you guide me to the correct usage? $\endgroup$ – Faseeh Jun 4 '15 at 17:56
  • $\begingroup$ Just write lm(A ~ B + C, data = dataset) where you have VAR right now. $\endgroup$ – tchakravarty Jun 4 '15 at 17:58

The whites.htest() function implements White's test for heteroskedasticity for vector autoregressions (VAR). It requires a varest object as input. However, from your description it seems that your model is not a VAR (vector autoregression) but a simple linear model.

Hence, the model should be estimated by lm() as previously suggested in the comments. Then you can use the bptest() function from the lmtest package to carry out White's test. The latter requires that you set up the terms in the auxiliary model yourself. It should look like this:

m <- lm(A ~ B + C, data = dataset)
bptest(m, ~ B*C + I(B^2) + I(C^2), data = dataset)

Note that B*C includes the main effects and their interaction (= product). Equivalently - and maybe somewhat more explicitly - we could also specify the auxiliary model as ~ A + B + I(A*B) + I(A^2) + I(B^2).

You can also look at

help("CigarettesB", package = "AER")

for a worked example.

| cite | improve this answer | |
  • $\begingroup$ Thank you Sir. I tried it and finally reached correct answer. Thank you so much for help. $\endgroup$ – Faseeh Jun 5 '15 at 9:43
  • 1
    $\begingroup$ @Faseeh, if this has resolved your question, please consider accepting it by clicking the check mark below the vote total on the left. $\endgroup$ – gung - Reinstate Monica Jun 5 '15 at 9:49
  • $\begingroup$ @gung, thank you for guiding me, i will keep visiting. :) $\endgroup$ – Faseeh Jun 5 '15 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.