BookmarkSubscribeRSS Feed
jojozheng
Quartz | Level 8

Hello everyone, 

 

I  run the following code and output is below.  What's the coefficient here means? And I also get a non-linear curve, so how can I get the equation or formula to output this curve? Thanks! 

 

proc transreg data=WORK.NLNONONLINREGSTATS_0001 detail;
model identity(act_fedcd) = spline(Life_q/nknots=9);
output predicted coefficients out=work.predict;

run;

2018-07-20 17_15_14-Project - Copy - Copy - SAS Enterprise Guide.png

 

2018-07-20 12_40_09-Project - Copy - Copy - SAS Enterprise Guide.png

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

I don't follow your question. What coefficient? 

 

You are fitting a non parametric model, so you can not get a parametric equation describing the fitted curve. But why do you want a formula for plotting purposes? You can use the outputted data to draw the curve? However, the procedure plots the curve on its own I assume since you are able to post the plot here?

jojozheng
Quartz | Level 8

@PeterClemmensen I need to predict much more value based on this fitting curve. I think it's better for me to have the plotting formula to plot more points beyond the points I have now? cause I have 1 intercept and 1 coefficient in this output table (right bottom corner) which I thought they are using for plotting curve? 2018-07-20 12_40_09-Project - Copy - Copy - SAS Enterprise Guide.png

 

plf515
Lapis Lazuli | Level 10
No. A spline curve has a very complex equation and it varies between knots of the spline
Peter 
plf515
Lapis Lazuli | Level 10

Your output was too small to read.  However, when you fit a spline, the formula for the curve is, naturally, very complicated. If you want a simple curve, don't fit a spline.  You can get a formula, but it will not be intuitive at all.

 

 

Rick_SAS
SAS Super FREQ

 

I think the easiest approach is to do the spline fitting by using PROC GLMSELECT instead of TRANSREG. The GLMSELECT procedure supports the STORE statement, which stores the model in an item store. You can use the PLM procedure to score additional data (and graph the results), as discussed in the article "Techniques for scoring a regression model in SAS."

 

If you want to stick with PROC TRANSREG, you can use the "missing value trick" to score the model on a new set of data.

 

If you use PROC GLMSELECT, the code will look similar to the following:

/* Generate training and scoring data by randomly splitting the Sashelp.Cars data into two parts */
data Cars1 Cars2;
set sashelp.cars(where=(weight<6000));
if rand("Bernoulli", 0.6) then output Cars1;
else output Cars2;
run;

/* Create and store model with PROC GLMSELECT. Score with PROC PLM */

/* fit model on Cars1 data */
proc glmselect data=Cars1;
effect spl = spline(weight/knotmethod=equal(9));
model mpg_city = spl;
store out=SplineModel;
run;

/* score model on Cars2 */
proc plm restore=SplineModel;
   score data=Cars2 out=Pred;
   effectplot;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1712 views
  • 3 likes
  • 4 in conversation