I have a test dataset looking like; | ID | Group | Week | | ------ | --------- | --------- | | X1 | Healthy | 0 | | X1 | Disease | 0 | | X1 | Healthy | 2 | | X1 | Disease | 2 | | X1 | Healthy | 5 | | X1 | Healthy | 16 | | X1 | Disease | 16 | | X2 | Healthy | 0 | | X2 | Disease | 0 | | X2 | Healthy | 2 | | X2 | Disease | 2 | | X2 | Healthy | 5 | | X2 | Disease | 5 | | X2 | Healthy | 16 | | X2 | Disease | 16 | | X3 | Healthy | 0 | | X3 | Disease | 0 | | X3 | Healthy | 2 | | X3 | Disease | 2 | | X3 | Healthy | 5 | | X3 | Disease | 5 | | X3 | Healthy | 16 | | X3 | Disease | 16 | | X4 | Disease | 0 | | X4 | Healthy | 2 | | X4 | Disease | 2 | | X4 | Healthy | 5 | | X4 | Disease | 5 | | X4 | Healthy | 16 | | X4 | Disease | 16 | As some part of the data were exampled above, I have 200 different 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?