Code Distinguishing IVs from Endogenous Variables
Posted: Fri Oct 23, 2015 10:25 am
Hello again,
The capture log and user guide have both been invaluable in my study on two stage LS. I'm hitting a roadblock, when I try to retrieve the p value from the chi sq distribution. The following chi sq syntax I found on pg 161 of eviews 8 object reference, but perhaps a different syntax is needed here? That's question #1.
Have a look at my simple program (almost complete):
For clarity, it's a chisq(1) distribution because the instruments outside the equation total two (iv1, iv2), and the endogenous variables total 1 (y2), i.e 2-1=1.
Question #2: In the program above, I put a 1 after @chisqprob(1), assuming that's what goes inside the parentheses -- the order, but I got an error, so I'm probably wrong. Nevertheless, once that's straightened out, I would like to improve the code in this procedure for the general case. Instead of a 1 or whatever goes there, I wanted to use code to reference the count of instruments outside the equation minus the endogenous variables. This way, whether I have 2, 3, or 4 IV's or 3-4 or endogenous variables or whatever combination of the two may be, my program will be robust in computing the correct chisq pval.
Thanks for reading
The capture log and user guide have both been invaluable in my study on two stage LS. I'm hitting a roadblock, when I try to retrieve the p value from the chi sq distribution. The following chi sq syntax I found on pg 161 of eviews 8 object reference, but perhaps a different syntax is needed here? That's question #1.
Have a look at my simple program (almost complete):
Code: Select all
equation 2SLS_eq.tsls y1 c y2 x1 x2 @ x1 x2 iv1 iv2
series error_hat = resid
equation overspec_eq.ls error_hat c x1 x2 iv1 iv2
scalar chi_val = overspec_eq.@regobs*overspec_eq.@r2
scalar chi_pval = chi_val.@chisqprob(1)
Question #2: In the program above, I put a 1 after @chisqprob(1), assuming that's what goes inside the parentheses -- the order, but I got an error, so I'm probably wrong. Nevertheless, once that's straightened out, I would like to improve the code in this procedure for the general case. Instead of a 1 or whatever goes there, I wanted to use code to reference the count of instruments outside the equation minus the endogenous variables. This way, whether I have 2, 3, or 4 IV's or 3-4 or endogenous variables or whatever combination of the two may be, my program will be robust in computing the correct chisq pval.
Thanks for reading