Turn on suggestions

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

Showing results for

- Home
- /
- Programming
- /
- Graphics
- /
- Extend Prediction Lines Beyond Data Scope

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-28-2014 01:47 PM
(2726 views)

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**;

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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**;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.