Programming the statistical procedures from SAS

plot bpline from glimmix?

Reply
Occasional Contributor
Posts: 9

plot bpline from glimmix?

Dear All,

I am attempting to fit a model using proc glimmix and to include bsplines for a few continuous predictors using effects.  The following is example code (actual has more variables) with two variables that are fit with a bspline and the other is a categorical variable.  I would like to plot each spline tranformation as a function of the original variable while controlling for the effects of other variables in the model.  In this case, a plot with transformation on the y-axis and agricden (the variable used to construct the spline) would be helpful.  I would like to do this because perhaps the plot will reveal that a simpler tranformation would work as well.  I've found a way to plot this using proc transreg with its specific plot options, but not for glimmix.  I've also plotted predicted values against the untransformed variable, but this does not control for the effect of spldevden (in this example).

PROC GLIMMIX Data=sas2 empirical=df initglm;

effect splagricden = spline(agricden/basis=bspline degree=3 knotmethod=percentiles(3));

effect spldevden = spline(devden/basis=bspline degree=3 knotmethod=percentiles(3));

MODEL devchng (event='1') = 

splagricden

agric

/link=logit dist=binomial ddfm=none s stdcoef cl;

output out=out1 pred(noblup ilink)=p resid(noblup ilink)=r pearson=rpear;

run;

Thanks,

Seth

Valued Guide
Valued Guide
Posts: 679

plot bpline from glimmix?

You should make the plots based on the output file you created with your code. The User's Guide gives a example that is almost the same as what you want.

http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glimmix_sect...

Of course, since you have binary data, the observations will consist of points across the bottom and top of the graph, with the predictions as smooth curve that goes from 0 to 1 (on the ilink scale).

Occasional Contributor
Posts: 9

plot bpline from glimmix?

Thanks, Ivm.  I saw that, but the example is with only one continuous variable and the effect of the categorical variable is controlled by plotting by group.  I'm looking to plot the spline while controlling for other continuous covariates.  I did what the example showed and the output is a wide scatter since for any level of agricden there are many values possible for the devden covariate.

Seth

Valued Guide
Valued Guide
Posts: 679

plot bpline from glimmix?

I think that would be much more difficult (athough perhaps other readers know an easy way). The problem is that there are no real slices to make for the graph (all combinations of predictions for all continuous variables would not be in the file).

Occasional Contributor
Posts: 9

plot bpline from glimmix?

If I knew the math better for b-splines, I could just calculate the variables contribution to the link function.  Perhaps I should be reading more about that. -Seth

Ask a Question
Discussion stats
  • 4 replies
  • 297 views
  • 0 likes
  • 2 in conversation