turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- plot bpline from glimmix?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-17-2012 05:09 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-18-2012 10:54 AM

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.

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-18-2012 12:47 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-18-2012 03:53 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-18-2012 07:24 PM

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