turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- 2 stage regression

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-12-2016 10:23 PM

I want to run second regression from the predicted value of first regression. I have made it on this paper in order to understand it. Bdr is the dependent variable in first regression and in the second stage the value from first regression is used as predicted bdr as regressor.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jahanzaib

12-12-2016 10:35 PM

Use an OUTPUT statement in the first regression to get the predicted values into a dataset and use that dataset to run the second regression.

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

12-12-2016 11:01 PM

Can you explain more how to connect output from first regression with second regression.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jahanzaib

12-12-2016 11:22 PM

Regression from step 1 creates a data set called reg_results.

Pass that to your second regression.

Proc glm data=SASHELP.class;

model weight = age height;

output out=reg_results p=Predict r=Resid;

run;quit;

proc glm data=reg_results;

model = ...;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-14-2016 04:08 AM

I have used following regression but it gives an error as shown in Picture.

Proc glm data=want1;

model bdr= fam EBITDA_TA MTB LNTA FA_TA RD_TA stdd;

output out=results p=Predict r=Resid;

run;quit;

proc glm data=results;

model cum= predict(bdr) EBITDA_TA MTB LnTA LnTA2 FA_TA RD_TA stdd assmat;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jahanzaib

12-14-2016 05:03 AM

Predict(bdr) -> what is this supposed to represent?

I don't think it does does what you think it does.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-14-2016 05:09 AM

predict(bdr) is the predicted value of bdr which i suppose to get from first level regression. then use that in the second regression as predicted value of bdr.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jahanzaib

12-14-2016 05:25 AM

As I said, it's not doing what you think.

Review your OUTPUT statement from the previous step.

P=Predict -> what do you think this portion does?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-14-2016 05:27 AM

i think it will predict all value of all the variables. moreover i do not understand r=Resid.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Jahanzaib

12-14-2016 05:43 AM

Like I mentioned, not what you think.

It it creates a predicted variable called PREDICT. The residuals (predicted - actual) are stored in a variable called Resid.

Open the dataset and examine if manually or run a proc contents and explore the variables there.

Proc contents data=reg_results;

run;