BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yanni_C
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

 

View solution in original post

3 REPLIES 3
SteveDenham
Jade | Level 19

Moved again to Forecasting and Econometrics community.

 

SteveDenham

SteveDenham
Jade | Level 19

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

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 646 views
  • 4 likes
  • 3 in conversation