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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Extend Prediction Lines Beyond Data Scope

- 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
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-28-2014 01:47 PM

I am trying to figure out how to make a prediction line extend beyond the scope of my data. For example, in an FDA guidance document (http://www.fda.gov/RegulatoryInformation/Guidances/ucm128092.htm) there is a sample stability plot where the data points stop at 12 months, but the regression and confidence line extend to 48 months (see plot below). Is it possible to do this simply with the SGPLOT procedure? Also, can I get just one confidence limit instead of both the upper and lower? Here is sample code of what I have done in an attempt to copy the graph (notice how my regression and prediction lines stop at 12 months and I have bot the upper and lower limits):

**data** stability;

input time impurity;

cards;

0 0.65

3 0.68

6 0.72

9 0.75

12 0.85

;

run;

**proc** **sgplot** data=stability;

title "Shelf life Estimation with Upper and Lower Acceptance Criteria Based on a Degradation Product at 25C/60% RH";

scatter x=time y=impurity/ markerattrs=(symbol=diamond);

reg x=time y=impurity/ lineattrs=(color=black) cli cliattrs=(clilineattrs=(color=black pattern=**1**));

refline **1.45** / lineattrs=(pattern=**4** thickness=**2** color=black);

xaxis label='Time Point (Months)' values=(**0** to **48** by **3**);

yaxis label="Degradation Product (%)" values=(**0** to **3** by **0.5**);

keylegend / position=right;

**run**;

Accepted Solutions

Solution

03-31-2014
02:54 PM

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

03-31-2014 02:54 PM

THIS IS NOT STATISTICALLY CORRECT.

However, I do recall the Confidence limits were a function of the original estimates plus something, just can't recall what the something is. But if you can figure it out this is a good starting point.

Also, this is time data, so you may want to look into the ETS procs.

data stability;

input time impurity;

cards;

0 0.65

3 0.68

6 0.72

9 0.75

12 0.85

15 .

18 .

21 .

24 .

;

run;

proc reg data=stability;

model impurity=time / cli;

output out=reg p=pred2 ucl=upper lcl=lower;

quit;

All Replies

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

03-28-2014 05:40 PM

I would approach this by using an actual regression procedure with the input data having the addition time points needed and then have the output data include the predicted values and limits. The procedure will provide a predicted value for independent x value in the input dataset. That way you could select which limit you would graph as well as indicating which of the markers are actual and predicted.

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

03-31-2014 02:37 PM

Can you give me an example of what you mean? I can get the predicted values for the data in range, but not extended beyond that. I attempted to use the stability data to get the parameter estimates. I then used that to assemble the formula for the regression line and was able to expand the predicted values. However, I can't get the 95% confidence limits. They are just the exact same as the predicted values. Can you tell me what I am doing wrong?

**data** stability;

input time impurity;

cards;

0 0.65

3 0.68

6 0.72

9 0.75

12 0.85

;

run;

/*** Get parmeter estimates for specified model ***/

ods listing close;

ods output ParameterEstimates=est;

**proc** **reg** data=stability;

model impurity=time;

**quit**;

ods listing;

/*** Store parameter estimates in macro variables ***/

**proc** **sql** noprint;

select estimate into :int from est where variable='Intercept';

select estimate into :time from est where variable='time';

**quit**;

/*** Create predicted values from the regression equation formed from parameter estimates ***/

**data** pred;

do time=**0** to **48** by **.1**;

pred=&int.+(&time.*time);

output;

end;

run;

/*** Rerun regression analysis to get confidence limits ***/

**proc** **reg** data=pred;

model pred=time / cli;

output out=reg p=pred2;

**quit**;

Solution

03-31-2014
02:54 PM

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

03-31-2014 02:54 PM

THIS IS NOT STATISTICALLY CORRECT.

However, I do recall the Confidence limits were a function of the original estimates plus something, just can't recall what the something is. But if you can figure it out this is a good starting point.

Also, this is time data, so you may want to look into the ETS procs.

data stability;

input time impurity;

cards;

0 0.65

3 0.68

6 0.72

9 0.75

12 0.85

15 .

18 .

21 .

24 .

;

run;

proc reg data=stability;

model impurity=time / cli;

output out=reg p=pred2 ucl=upper lcl=lower;

quit;

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

03-31-2014 03:01 PM

I can't validate if this is correct or if it is just getting me something that looks very close, but it looks like just adding the missing y-values for the x-values beyond the scope of the data did the trick. Thanks!

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

03-31-2014 03:20 PM

Prediction intervals have a different formula than confidence intervals. If you're trying to calculate the prediction confidence intervals it will be a different formula.