How do I generated confidence Intervals for 2-year Lagged Predicted Values

Reply
Occasional Contributor
Posts: 13

How do I generated confidence Intervals for 2-year Lagged Predicted Values

Hello,

 

My dataset is in the following format

 

Year Exposure Outcome

2001 10 35

2002 23 45

2003 12 78

2004 17 70

2005 27 80

2006 59 100

2007 39 190

2008 20 391

2009 60 192

2010 10 53

 

Both Exposure and Outcome are continuous variables. I have constructed a simple linear regression model with Exposure as the independent variable and Outcome as the dependent variable.

 

Based on the results of the linear regression, I have manually generated predicted values of the Outcome for given exposure values with 2-year lag period (e.g. prediction for 2003 based on 2001 exposure). How can I automate this process in SAS because I need the corresponding 95% confidence intervals for the predicted values?

 

Thank you.

Valued Guide
Posts: 513

Re: How do I generated confidence Intervals for 2-year Lagged Predicted Values

Please do not cross post, most of the users in here are on multiple communities, so stick to the statistical procedures community for this one Smiley Happy

Occasional Contributor
Posts: 13

Re: How do I generated confidence Intervals for 2-year Lagged Predicted Values

Sorry I am new here, I'll continue posting on that thread. Thanks!

Valued Guide
Posts: 513

Re: How do I generated confidence Intervals for 2-year Lagged Predicted Values

No Problem Smiley Happy

Occasional Contributor
Posts: 13

How do I: Generate confidence Intervals for 2-year Lagged Predicted Values

Hello,

 

My dataset is in the following format

 

Year Exposure Outcome

2001 10 35

2002 23 45

2003 12 78

2004 17 70

2005 27 80

2006 59 100

2007 39 190

2008 20 391

2009 60 192

2010 10 53

 

Both Exposure and Outcome are continuous variables. I have constructed a simple linear regression model with Exposure as the independent variable and Outcome as the dependent variable.

 

Based on the results of the linear regression, I have manually generated predicted values of the Outcome for given exposure values with 2-year lag period (e.g. prediction for 2003 based on 2001 exposure). How can I automate this process in SAS because I need the corresponding 95% confidence intervals for the predicted values?

 

Thank you.

Valued Guide
Posts: 513

Re: How do I: Generate confidence Intervals for 2-year Lagged Predicted Values

The simple linear regression can be done like this

 

data have;
input Year Exposure Outcome;
datalines;
2001 10 35
2002 23 45
2003 12 78
2004 17 70
2005 27 80
2006 59 100
2007 39 190
2008 20 391
2009 60 192
2010 10 53
;

proc reg data = have;
model Outcome = Exposure / cli clm;;
run;

Though I am not sure what you are askeing regardring lagging values? Do you want to lag values of outcome before of after the regression analysis?

Occasional Contributor
Posts: 13

Re: How do I: Generate confidence Intervals for 2-year Lagged Predicted Values

Thank you for your response.

 

The abovementioned code gives a regression equation as follows,

 

Outcome = Constant + Beta*Exposure

Outcome = 83.23453 + 1.45002*Exposure

 

If I want to predict Outcome for 2005, then it would be 122.4 (83.23453 + 1.45002*(27)). However, if I lag the exposure by 2-year period, then it would be 100.6 (83.23453+ 1.45002*(12)). SAS does the former automatically, but I need to automate the latter because I need the corresponding confidence intervals for the predicted values based on 2-year exposure lag. I hope this clarified the question.

Grand Advisor
Posts: 17,356

Re: How do I: Generate confidence Intervals for 2-year Lagged Predicted Values

What you're asking for is called scoring a dataset. There are multiple options to do so which are illustrated here:

http://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html

 

You will need to lag the data yourself though because you're using a REG model, if you were using a Time Series Proc it may be more automated. 

 

 

 

 

Grand Advisor
Posts: 17,356

Re: How do I: Generate confidence Intervals for 2-year Lagged Predicted Values

[ Edited ]

FYI @ImSame & @draycut I've merged the two threads into one.

EDIT: three threads...

Ask a Question
Discussion stats
  • 8 replies
  • 129 views
  • 1 like
  • 3 in conversation