I am given a code in R and have to translate to SAS. Is there a SAS equivalent of the R-PSPLINE function in SAS? I could not find any relevant resources online. Basically I need to translate the following in SAS,
coxph(Surv(time,death)~sex+pspline(age,df=4),data=have)
You should think about what the R model is trying to do. It is likely that author of the model chose penalized B splines simply to capture the potential that the survival rate has a potentially complicated relationship with the AGE variable. The specific form of the spline probably doesn't matter. In fact, if it is a good model, it should be robust to changes in the spline family. SAS supports B-splines, PB-splines, thin-plate splines, cubic splines, adaptive regression splines, and more, but in my experience, the form of the splines often has little impact on the predictive model.
For an example of two models that illustrate my points, see "Nonparametric regression for binary response data in SAS.' The example shows two completely different (nonparametric) models that give roughly the same predictive model. If they didn't give similar predictions, then one or both models are probably not good.
I encourage you to use the EFFECT statement in PROC PHREG to construct a model that uses either the BSPLINE or TPF spline basis. Compare the models' predictions to the R model. In most applications, the goal is to find a good model, not to worry about technical differences between different spline models.
Thanks Reeza.
TPSPLINE will not work as I need to use this on survival data. The only way around I see is to create the variables in data step and then use it in MODEL statement in PROC SURVIVAL. I was hoping there is an easy way to do it.
I meant PROC PHREG.
How is what the R package does different than the Penalized B-splines of proc transreg?
https://documentation.sas.com/doc/en/statcdc/14.2/statug/statug_transreg_details07.htm
Upon reading further it seems like it is not implemented in SAS. Not sure why given it is used so often.
https://bmcmedresmethodol.biomedcentral.com/articles/10.1186/s12874-019-0666-3
Also calling @StatDave @lvm @SteveDenham
You should think about what the R model is trying to do. It is likely that author of the model chose penalized B splines simply to capture the potential that the survival rate has a potentially complicated relationship with the AGE variable. The specific form of the spline probably doesn't matter. In fact, if it is a good model, it should be robust to changes in the spline family. SAS supports B-splines, PB-splines, thin-plate splines, cubic splines, adaptive regression splines, and more, but in my experience, the form of the splines often has little impact on the predictive model.
For an example of two models that illustrate my points, see "Nonparametric regression for binary response data in SAS.' The example shows two completely different (nonparametric) models that give roughly the same predictive model. If they didn't give similar predictions, then one or both models are probably not good.
I encourage you to use the EFFECT statement in PROC PHREG to construct a model that uses either the BSPLINE or TPF spline basis. Compare the models' predictions to the R model. In most applications, the goal is to find a good model, not to worry about technical differences between different spline models.
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!
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.