White's test manually

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

sean123
Posts: 34
Joined: Wed Apr 25, 2012 11:53 am

White's test manually

Postby sean123 » Wed Jul 11, 2012 5:35 am

Hello,

I'm trying to construct White's heteroscedasticity test manually in order to be able to apply it to a system of equations. Perhaps there is already someone out there who has done this and if so I'd be very grateful for help with this.

Initially, one would think it shouldn't be that hard: replicate what's done in a VAR object when performing the test to get the same results and then simply use residual series from a system object instead. Sadly, it doesn't seem to be that simple.

White's test without cross-products is, in a univariate case, done in Eviews by regressing the squared residual upon the squared independent variable(s). In the multivariate case, how is the test carried out? The test itself says "(only levels and squares)", which in a bivariate model would mean resid^2 c x^2 y^2, no?
Here's a short example:

Code: Select all

create q 1990q1 1994Q4 'create file and variables series x = nrnd series y = nrnd var var.ls 1 2 x y @ c 'estimate the bivariate var model show var.white var.makeresids res_x res_y 'create the residual series res_x=res_x*res_x 'redefine the residual series as squared residuals res_y=res_y*res_y equation test.ls res_x c x^2 y^2 'regress the squared residuals upon levels and squares of the variables show test equation uni.ls y c x 'estimate a linear regression model uni.makeresids resid_uni 'create its residual series show uni.white equation uni_res.ls resid_uni^2 c x^2 show uni_res
The R-squared from the White test in the var model (called "var") is not the same as in the linear regression with res_x as regressand (model called "test"). It's not the same when eliminating the levels from the equation either. For the sake of completeness the program also shows the replication of White's test in the univariate case as mentioned earlier (equation "uni" and "uni_res").

So, the question is: exactly how is White's test without cross-terms carried out in the VAR procedure? If I learned that, then transferring it to a system of equations should not be very hard. Any help appreciated!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: White's test manually

Postby EViews Gareth » Wed Jul 11, 2012 7:51 am

Change your test equation to be:

Code: Select all

equation test.ls res_x c x(-1) x(-2) y(-1) y(-2) x(-1)^2 x(-2)^2 y(-1)^2 y(-2)^2
Remember the "regressors" in the VAR are the lagged values of the endogenous variables.

sean123
Posts: 34
Joined: Wed Apr 25, 2012 11:53 am

Re: White's test manually

Postby sean123 » Wed Jul 11, 2012 11:20 pm

Of course! That's an embarrasing mistake, thanks a lot! Would you perhaps also be able to answer the following: How do I obtain the joint Chi square value? The joint value seems not to simply be the sum of the individual values, but something else, and I don't really know what this something else is. Thanks again!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: White's test manually

Postby EViews Gareth » Thu Jul 12, 2012 8:31 am

Code: Select all

create u 100 rndseed 1 series y=nrnd series x=nrnd var v.ls 1 2 x y v.makeresids group rgroup resid01*resid01-@mean(resid01*resid01) resid02*resid02-@mean(resid02*resid02) resid01*resid02-@mean(resid01*resid02) matrix rcov = @inverse(@inner(rgroup)/98) equation eq1.ls resid01*resid01 c x(-1) x(-2) y(-1) y(-2) x(-1)^2 x(-2)^2 y(-1)^2 y(-2)^2 equation eq2.ls resid02*resid02 c x(-1) x(-2) y(-1) y(-2) x(-1)^2 x(-2)^2 y(-1)^2 y(-2)^2 equation eq3.ls resid02*resid01 c x(-1) x(-2) y(-1) y(-2) x(-1)^2 x(-2)^2 y(-1)^2 y(-2)^2 eq1.makeresid res1 eq2.makeresid res2 eq3.makeresid res3 group resgroup res1 res2 res3 matrix ucov = @inner(resgroup)/98 scalar stat = 98*3*(1-@trace(rcov*ucov)/3) show stat show v.white

sean123
Posts: 34
Joined: Wed Apr 25, 2012 11:53 am

Re: White's test manually

Postby sean123 » Wed Jul 25, 2012 1:45 am

Beautiful :D Thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests