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.
White test in loops
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
-
kipfilet_09
- Posts: 10
- Joined: Wed Oct 01, 2014 12:20 pm
Re: White test in loops
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?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: White test in loops
You need to loop through your equations, freezing the white test into a table, extracting the values out and then doing the comparison.
-
kipfilet_09
- Posts: 10
- Joined: Wed Oct 01, 2014 12:20 pm
Re: White test in loops
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.
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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: White test in loops
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:
You already mentioned the correct command for performing the white test:
Code: Select all
eq.hettest(type=white, c)
-
kipfilet_09
- Posts: 10
- Joined: Wed Oct 01, 2014 12:20 pm
Re: White test in loops
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!
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!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
-
kipfilet_09
- Posts: 10
- Joined: Wed Oct 01, 2014 12:20 pm
Re: White test in loops
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!
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!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: White test in loops
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest
