Solved – Testing homoscedasticity with Breusch-Pagan test

heteroscedasticityr

In these days I'm working with Breusch-Pagan to test homoscedasticity.

I've tested the prices of two stocks with this method. This is the result:

> mod <- lm(prices[,1] ~ prices[,2])
> bp <- bptest(mod)
> bp

    studentized Breusch-Pagan test

data:  prices[, 1] ~ prices[, 2] 
BP = 0.032, df = 1, p-value = 0.858

Reading the result the series should be homoscedastic, but if I plot the residuals and the squares residuals it seems totally not! Take a look below:

enter image description here

the Residuals Vs FItted below:

enter image description here

How is it possible this series pass the test with a very high p-value?

Best Answer

The problem isn't heteroskedasticity, that's why it's passing the test. The problem is that your model doesn't work well for (at least some of) your observations.

I've never seen anyone analyze stock prices without looking at their differences. Try a Dickey-Fuller test for a unit root---I bet that you can't reject that there is one, as @mpiktas alludes to in his comment.

If there isn't a unit root, perhaps there is a time trend or seasonality. You might try including a linear time trend or seasonal components.

Alternatively, you might try working with the log of the prices, which sometimes helps the fit.