BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

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;

Shelf life estimation with upper acceptance criterion based on a degradation product at 25C/60%RH

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

5 REPLIES 5
ballardw
Super User

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.

djbateman
Lapis Lazuli | Level 10

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;

Reeza
Super User

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;

djbateman
Lapis Lazuli | Level 10

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!

Reeza
Super User

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.

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2853 views
  • 0 likes
  • 3 in conversation