Page 1 of 1
White test in loops
Posted: Wed Oct 01, 2014 12:29 pm
by kipfilet_09
Hi everyone
I am trying to run a code where a number of regressions is examined so that if the chisquare of the white test output for each regression is greater than the chi square critical value, a new regression is etsimated with corrected estimators. The following code is the one I have and not working:
FOR !j=1 to 5
FOR !I=6 TO 12
if B_Q!j_!I_ALL.@chisq > chisq(.95,5) then
WW_B_Q!j_!I_ALL.ls(h) bq!j_!i c yaq!j_!i
ENDIF
NEXT
NEXT
I have also tried eq.hettest(type=white, c) suggetsed in another topic but still to no avail.
I hope the code is not entirely wrong I use coding only out of necessity because of the hundreds of regressions I have to do.
Re: White test in loops
Posted: Wed Oct 01, 2014 12:49 pm
by EViews Gareth
Re: White test in loops
Posted: Wed Oct 01, 2014 3:07 pm
by kipfilet_09
Thank you Graeth I have already seen this thread but I haven't succeeded in combining freezing with loops. can't it be done with some basic looping and reference of both the white test and the statistic of chisquare?
Re: White test in loops
Posted: Wed Oct 01, 2014 3:37 pm
by EViews Gareth
You need to loop through your equations, freezing the white test into a table, extracting the values out and then doing the comparison.
Re: White test in loops
Posted: Thu Oct 02, 2014 11:20 am
by kipfilet_09
I get the logic you're correct but I can't use freeze within a loop I mean the regression output window has to be already opened and I i don't know how to do this.
also the thread has the ".wald" suffix for this test but I can't find the proper one for white. (h) doesn't seen to work. I know I'm not asking anything really that difficult I am just not experienced with eviews coding. The solution has to be quite concise and straightforward. I'm sure others had the same problem with me before.
Thank you for your help anyway.
Re: White test in loops
Posted: Thu Oct 02, 2014 11:24 am
by EViews Gareth
I don't understand your comment on why you can't use freeze in a loop.
You already mentioned the correct command for performing the white test:
Re: White test in loops
Posted: Thu Oct 02, 2014 12:27 pm
by kipfilet_09
Ok Gareth I got it tested and working:
matrix (2,7) m1
FOR !j=4 to 5
FOR !I=6 TO 12
freeze(tab!j!i) BEPS_Q!j_!I_ALL.hettest(type=white, c) c(1)=0
if @val(tab!j!i(4,2))>@qchisq(.95,5) then
m1(!j-3,!i-5)= @val(tab!j!i(4,2))
endif
delete tab!j!i
next
next
the if-endif part can be ommited just checks if the critical value is exceeded (one needs only have the "m1(!j-3,!i-5)= @val(tab!j!i(4,2))" part)
I guess I can't figure out a way to just have the outputs of the white test (as regressions) only for the initial regressions that the RSQUARED*OBS surpasses the critical value (qchisq(.95,5)), which was what I needed in the first place but this works as well.
Please remember this post about running the white test in loops and saving the output when the critical value is surpassed, I'm sure it will come handy to other people with the same problem.
Do you know if there is any thread of general discussion about theoretical econometric issues in this forum (ex. when and how to deal with multicollinearity etc?)?
Thanks so much for the help!
Re: White test in loops
Posted: Thu Oct 02, 2014 1:17 pm
by EViews Gareth
Re: White test in loops
Posted: Tue Oct 07, 2014 2:52 pm
by kipfilet_09
Dear Gareth thank you for your help!
Instead of the white test previously applied correctly, I tried the newey-west one, replacing "white" with "hac" but I get this "insufficient number of coefficients" error. Is this because the hac test is not an actual hettest and if yes what should be the correct code?
What is also the relevant command for the serial correlation LM test? I can't find it anywhere...
FOR !j=4 to 5
FOR !I=6 TO 12
freeze(tab!j!i) BEPS_Q!j_!i_ALL.hettest(type=hac, c) c(1)=0
if @val(tab!j!i(2,4))>@qchisq(.95,5) then
m1(!j-3,!i-5)= @val(tab!j!i(2,4))
endif
delete tab!j!i
next
next
Thank you so much in advance!
Re: White test in loops
Posted: Tue Oct 07, 2014 3:01 pm
by EViews Gareth
I don't know what you mean by "newey-west" in the context of a heteroskedasticity test.
All equation based tests and procedures are documented in the Equation section of Chapter 1 of the EViews Object Reference. The PDF of this is available from the help menu.