How to get residual when using SAS to do GMM?
Here is an example:
proc sort data;by id ;run;
proc model data;
endo ri;
exog mp smb hml;
instruments _exog_;
parms b0 b1 b2 b3;
ri= b0+b1*mp+b2*smb+b3*hml;
fit ri/gmm kernel=(bart,1,0);
by sizeport0 btmport0 ciiport0 ;
ods output parameterestimates=parameterestimates;
run;
quit;
I want to get residual in the dataset, but I do not know how to get it.
Thank you in advance.
Add the out=resid outresid option to the FIT statement, like this:
proc model data;
endo ri;
exog mp smb hml;
instruments _exog_;
parms b0 b1 b2 b3;
ri= b0+b1*mp+b2*smb+b3*hml;
fit ri/gmm kernel=(bart,1,0 ) out=resids outresid outactual;
by sizeport0 btmport0 ciiport0 ;
ods output parameterestimates=parameterestimates;
run;
So long as there is no conflict between the GMM method, the kernel option and these additional options, you should get a dataset named resids containing the residuals and the actual values of the endogenous variables.
SteveDenham
Moved to stats community.
Moved again to Forecasting and Econometrics community.
SteveDenham
Add the out=resid outresid option to the FIT statement, like this:
proc model data;
endo ri;
exog mp smb hml;
instruments _exog_;
parms b0 b1 b2 b3;
ri= b0+b1*mp+b2*smb+b3*hml;
fit ri/gmm kernel=(bart,1,0 ) out=resids outresid outactual;
by sizeport0 btmport0 ciiport0 ;
ods output parameterestimates=parameterestimates;
run;
So long as there is no conflict between the GMM method, the kernel option and these additional options, you should get a dataset named resids containing the residuals and the actual values of the endogenous variables.
SteveDenham
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!