GAMM plot??

Hi everyone,

I would like some help.

I did a multilevel analysis using GAMM from mgcv package and plot the predict values with the confidence intervals. I read in a few foruns that the plot only use the fixed part from the equation to predict the values used in the plot. Could anyone knows if it´s right?? If so, how can I plot the predicted values with both equations part (fixed and random).

Thanks a lot!

Hi Jake,

I want to show the predict values from the equation with the confidence intervals. The result from GAMM takes into account both parts, so I want to show the more realistic result possible.
With Stata, I was able to plot the predict value per subject, but I´m trying to find out how to plot the mean value with CI.
Just to confirm, do you know if the GAMM plot take into account only the fixed part from the equation? I still have doubts about it.

Last edited:


Cookie Scientist
Yes, as far as I know, the plots for GAMMs in mgcv only incorporate uncertainty in the fixed effects.

The reason I ask why you want the uncertainty in the random effects is because I'm not sure if the interpretation of such an interval really matches what you're interested in talking about. If you only incorporate uncertainty in the fixed effects, then you have a typical confidence interval: the interval gives the set of null-hypothetical values for the population average that you would fail to reject. If you add in uncertainty due to the random effects, then it becomes something closer to a prediction interval: if I draw independent samples of clusters over and over again, the cluster effects in these samples should fall in the specified range, say, 95% of the time. If this latter thing is really what you want to be talking about, then fine, but it's not immediately obvious if that's the thing you care about. If you're only trying to make a statement about the population average effect, then arguably you don't need to consider uncertainty in the random effects.