BookmarkSubscribeRSS Feed
raisins
Calcite | Level 5

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

4 REPLIES 4
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

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).

raisins
Calcite | Level 5

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

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

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).

raisins
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 1740 views
  • 0 likes
  • 2 in conversation