Programming the statistical procedures from SAS

B spline in GLM

Reply
New Contributor
Posts: 3

B spline in GLM

 

How could one jointly estimate GLM parameter along with fitting B spline to the parameters of factor levels. I am using PROC HPGENSELECT

SAS Super FREQ
Posts: 3,304

Re: B spline in GLM

You can use PROC GLMSELECT for these tasks.  I'm not sure what you mean by "jointly estimate." You cannot simultaneously estimate two different models; you would need to run a procedure twice. However, maybe you meant "main effects plus spline terms." If so, that is easily done.

 

To fit the GLM model, use the usual syntax. If yu don't want variable selection, use the SELECTION=NONE option on the MODEL statement.

 

To fit the B splines, use the EFFECT statement and the SPLINE option with BASIS=BSPLINE. An example is available in the article "Regression with restricted cubic splines in SAS". The article uses a different spline basis, but contains the main ideas.  

 

If you have questions, I suggest you post them using the example data in the blog post.

New Contributor
Posts: 3

Re: B spline in GLM

Thanks for your reply, the idea behind joint estimation of spline was to smooth the parameter and also carry-over the impact to estimation of other parameters.

Is it possible to mannually select the position of knots and the shape of curve or would I have to leave it to SAS to give the best fit. What if I wanted to give my own relationship derived from elsewhere. 

 

 

 

SAS Super FREQ
Posts: 3,304

Re: B spline in GLM

Yes, the blog post (and documentation) shows how to set the location of the knots. Yes, you can generate the spline basis functions (also in the article!) and then score the model using coefficients that you specify. You can use PROC SCORE or the DATA step to score the model.

 

I do not know what you mean by "smooth the parameter and also carry-over the impact to estimation of other parameters."  I suggest you read the article, play with the procedure, and then post data, code, and desired output.  

Ask a Question
Discussion stats
  • 3 replies
  • 76 views
  • 0 likes
  • 2 in conversation