Open isabellaghement opened 2 years ago
Hi @isabellaghement,
Great question! Give me a couple days to get back to you on this, though; I'm deep into final exams and grading right now, and I'd rather give this and the other fun GAM questions I have right now the time they deserve.
Thank you so much for adding this question on your To Do list, Eric! I guess ultimately I am wondering what those random factor (aka non-linear) smooths integrate to when we take their expectation over all subjects represented by the ones included in the data. It doesn't seem to me like they are integrating to 0 (which would be the case with random intercepts or random slopes in lmer or glmer models), which makes it tricky to talk about "average" effect even when interpreting effects on the linear predictor scale.
Good luck with your final exams and grading - it will be good to get everything done and out of the way so that you can get into holiday mode. This has been a hard and exhausting term for everyone who has been teaching.
Not sure this is the best place to ask this question, but it's been bugging me for a while now.
The HGAM paper talks about Model GS (global smoother plus group-level smoothers with a shared penalty). I have difficulty understanding what this global smoother means in a logistic HGAM model. Using simulated data from the itsadug package, here is an example of such model (I simplified the data to include only 10 subjects: 5 adults and 5 children).
The R commands below show how I prepared the data:
Here is the logistic HGAM:
The smooths included in this model are given by:
and are "s(Time):GroupChildren", "s(Time):GroupAdults" and "s(Time,Subject)".
The first two smooths are "global" smooths of Time for Children and Adults, respectively. These smooths can be visualized with the R command:
and look as follows:
The random factor smooths encompassed by "s(Time,Subject)" look like this:
The R code for visualizing the random factor smooths is:
The effect of Time for each of the actual Subject can be plotted on the log odds scale, leading to the following plot:
In this plot, I also show the effect that would correspond to the "global" smooth in each of the two groups: Adults and Children.
Furthermore, the effect of Time for each of the actual Subject can be plotted on the probability scale, leading to the following plot:
Usually, with these types of mixed effects models, a non-linear link function (in this case, logit) means that conditional effects (e.g., effect of Time on probability that Y = 1 for a specific Subject in a specific Group) are different animals than marginal effects (e. g., effect of Time on probability that Y = 1 averaged across all Subjects in a specific Group).
On the log odds scale, I think this differentiation between conditional and marginal effects is immaterial, as the two effects would be the same (?).
While I feel relatively comfortable describing the effect of Time on the log odds that Y = 1 for Adults or for Children as representing an "average effect" across all the children in that group in the underlying population, I am not sure what language to use to describe the same effect when expressed on the probability scale. I don't think it would be an "average effect" anymore? (One thing that bothers me about the "average" interpretation is that the random factor smooths do NOT average to 0.)
Usually, if the model included only random intercepts and/or a random slopes for Time, I would use language like "effect for typical subject" to describe the effect of Time on the log odds that Y = 1 for Adults or for Children. A "typical subject" would be one for whom the random intercepts and/or random slopes were equal to 0. But when the model includes by-subject random factor smooths for Time and a non-linear link, I am not sure this "typical subject" language makes sense when we "exclude" the random factor smooth "s(Time,Subject)" from the model.
I would very much appreciate any thoughts or pointers on language that is safe to use to describe what the "global" smooths represent in the context of a logistic HGAM. (Maybe I am over-complicating this in my mind, but that is how my mind works - it builds on what it already knows and that can be a hindrance at times.)
In case this may help, here is the R code I used for constructing the plot of effects of Time on the log odds scale:
Furthermore, here is the R code I used for constructing the plot of effects of Time on the probability scale: