In R, I did the Whites' test (aka. Brush Pegan Test). I found the p-value is different. Can you please have a look and check if there is a mistake in my code.
The R-code and output
R> attach(mtcars)
R> model = lm(mpg~hp+wt+gear,mtcars)
R> library(lmtest)
R> bptest(model,data=mtcars)
studentized Breusch-Pagan test
data: model
BP = 1.3627, df = 3, p-value = 0.7143
The Julia code and output
using HypothesisTests
function BPTest(container:: FrequentistRegression, data::DataFrame)
fm_frame = ModelFrame(container.formula, data);
X=modelmatrix(fm_frame)
e = residuals(container)
BP_Test1 = WhiteTest(X,e);
return(BP_Test1);
end
BP_tst = BPTest(mod1,train_df)
White's (or Breusch-Pagan's) test for heteroskedasticity
--------------------------------------------------------
Population details:
parameter of interest: T*R2
value under h_0: 0
point estimate: 8.73554
Test summary:
outcome with 95% confidence: fail to reject h_0
one-sided p-value: 0.4620
Details:
T*R^2 statistic: 8.73554
degrees of freedom: 9
type: White
pvalue(BP_tst)
0.46203539153321815
Hi
In
R
, I did the Whites' test (aka. Brush Pegan Test). I found the p-value is different. Can you please have a look and check if there is a mistake in my code.The
R
-code and outputThe
Julia
code and output