I have a test dataset looking like;
ID | Sample | Group | Week |
---|---|---|---|
X1 | Sample1 | Healthy | 0 |
X1 | Sample2 | Disease | 0 |
X1 | Sample3 | Healthy | 2 |
X1 | Sample4 | Disease | 2 |
X1 | Sample5 | Healthy | 5 |
X1 | Sample6 | Healthy | 16 |
X1 | Sample7 | Disease | 16 |
X2 | Sample8 | Healthy | 0 |
X2 | Sample9 | Disease | 0 |
X2 | Sample10 | Healthy | 2 |
X2 | Sample11 | Disease | 2 |
X2 | Sample12 | Healthy | 5 |
X2 | Sample13 | Disease | 5 |
X2 | Sample14 | Healthy | 16 |
X2 | Sample15 | Disease | 16 |
X3 | Sample16 | Healthy | 0 |
X3 | Sample17 | Disease | 0 |
X3 | Sample18 | Healthy | 2 |
X3 | Sample19 | Disease | 2 |
X3 | Sample20 | Healthy | 5 |
X3 | Sample21 | Disease | 5 |
X3 | Sample22 | Healthy | 16 |
X3 | Sample23 | Disease | 16 |
X4 | Sample24 | Disease | 0 |
X4 | Sample25 | Healthy | 2 |
X4 | Sample26 | Disease | 2 |
X4 | Sample27 | Healthy | 5 |
X4 | Sample28 | Disease | 5 |
X4 | Sample29 | Healthy | 16 |
X4 | Sample30 | Disease | 16 |
The ID columns define each subject that paired samples collected from. There are total of four time points; 0, 2, 5, and 16.
As some part of the data were exampled above, I have 200 different log-transformed measurements taken from each paired sites at each time point, but not all subjects have complete sample sets. Assuming the measurements are not following linear trend, can you please suggest (to someone who is pretty new to the GAMs/GAMMs) how can I perform testing whether measurements have significantly different longitudinal trend between healthy and disease groups by taking care of the paired sampling strategy using GAM or GAMMs in R?
PS: I tried some models such as
gam(Measurement1 ~ Group + Week +
s(ID, bs = 're'),
data = data, method = 'REML')
but I need some other families to test rather than Gaussian.
ID
represent an individual, and the Healthy/DiseaseGroup
represent two distinct (anatomical) sites on the same individual? And are there only 4 time points (at most) for each individual? Please provide that information by editing the question directly, as comments on this site are easy to overlook and can be deleted. $\endgroup$