The data in question comprise two response groups (
no response vs.
stress signal), different individuals, repeated measures through time for each individual (
period), and a continuous variable for a metabolic marker. The stress signal, if present, was always limited to a single sampling period.
What I'm looking to test is two-fold:
- is the type of response related to the concentration of the metabolic marker, and
- do stress signals within individuals significantly correspond to spikes in the metabolic marker relative to the rest of the periods sampled?
I would like to remove individual variation (random effect) and slope variation across periods for each individual (because the metabolic marker naturally changes within individuals as a factor of time, but varies across individuals in this speed of this change). The natural pattern of change across periods is also non-linear (best fit by a second-order polynomial).
This is the model I've built in R using
gamm4 to test overall response differences:
> OverallRespModel <- gamm4(response ~ s(marker), random=~ (1|period) + (period|individual), data=Data, family= gaussian)
The similar model I've built to test within-individual associations between the presence of the stress mark and metabolic marker spikes is:
> PeriodRespModel <- gamm4(response ~ s(marker), random=~ (1+period|individual), data=Data, family=gaussian)
My concerns are:
- Whether these two models will address the questions I am asking, respectively.
- That my additive model is simply fitting a spline to the metabolic marker data (as a factor of period, hopefully), and I'm not sure how to customize this fit to force a second-order polynomial fit.
Should I alternatively use the metabolic marker as the response variable and the presence / absence of stress markers as a binary predictor variable?