I'm trying to plot the effect of a continuous variable (VAR1) on the response from a Generalized Linear Mixed Model. In other words, I'd like to predict the response *y* when VAR1 is *x*, setting all other variables to their mean (so they have no effect on the predicted value). I use SAS program, and I'm not quite sure how to accomplish this.

I've used option *LSMEANS* in SAS for my categorical fixed effects in my earlier models. I do have some class covariates in the model, one on its own and second nested within third, that is CLASS1 and CLASS2(CLASS3). I first plotted the *LSMEANS* of CLASS1, using the *at*-option to specify a value of VAR1 and then picking the estimate + SE from the CLASS1 level, which had the estimate of 0. *LSMEANS* gives me the mean and standard error also back-transformed which is essential (*dist=binary* in model statement). I somehow on first thought interpreted the zero-estimate of CLASS1 as "no effect", but actually the effect is included already in the intercept, right? So, how would one set the effect of CLASS1 (has only two levels) also to its mean, i.e. zero? Would a mean from the estimates of the two levels of CLASS1 do the trick? And what about the standard errors and CI?

Of course, I'm happy to use also other methods than *LSMEANS*, if you have any suggestions. For my other model (Gaussian with a different response, but otherwise the model's the same) I also thought of just plotting *y = intercept + x × VAR1-estimate*, using values from the table of estimates for fixed effects. However, this does again set all class variables to their zero level and not their mean, correct? Also, I was unsure how to proceed in calculating the correct CI. Using just *"SE of VAR1 × 1.96"* gave very narrow intervals, masked under the estimate line in my plots.

I know this must be pretty basic stuff, but after a lot of searching I was unable to find any concrete advise or examples.

**Contents**hide

#### Best Answer

Check out the PLM procedure in SAS:

http://support.sas.com/resources/papers/proceedings10/258-2010.pdf

and, of course, the PLM documentation and examples within.

Using PLM, you can specify an input dataset with your desired values for the predictor variables and use the SCORE statement to obtain the predicted values (as well as standard errors, confidence limits, and prediction limits) on either the model scale or the inverse link scale from the model.

For a categorical predictor, say CLASS1, you cannot specify a value other than the observed levels of CLASS1. For example, if CLASS1 has two levels (0 and 1), you cannot obtain a prediction by specifying CLASS1=0.5. You can, however, use the ESTIMATE statement to compute the average of the CLASS=0 and the CLASS=1 values for a specified value of VAR1. You could use ESTIMATE in either the original procedure (e.g., GLIMMIX) or in PLM.

Hope this helps,

Susan

### Similar Posts:

- Solved – ANOVA in SAS: Not Statistically Significant but LSMEANS says is
- Solved – ANOVA in SAS: Not Statistically Significant but LSMEANS says is
- Solved – ANOVA in SAS: Not Statistically Significant but LSMEANS says is
- Solved – ANOVA in SAS: Not Statistically Significant but LSMEANS says is
- Solved – Examining trends with interactions and with stratification – obtaining discordant results