I have finished a trial where we measured continously measurements like blood pressure
id time measurement behA
21 2 y1 24.86951 0
22 3 y1 22.06246 0
23 5 y1 23.63033 0
24 6 y1 23.14541 0
25 7 y1 22.79180 0
26 8 y1 24.33016 0
27 9 y1 21.00754 0
28 10 y1 25.25475 0
29 11 y1 17.90951 0
30 12 y1 16.81754 0
31 13 y1 20.11344 0
41 2 y2 69.00000 0
42 3 y2 69.80213 0
43 5 y2 61.71574 0
44 6 y2 50.56885 0
45 7 y2 53.44689 0
46 8 y2 62.66082 0
47 9 y2 44.55164 0
48 10 y2 55.81049 0
49 11 y2 40.25721 0
50 12 y2 34.86508 0
51 13 y2 31.43689 0
61 2 y3 49.72607 0
62 3 y3 81.03049 1
63 5 y3 65.83426 0
64 6 y3 43.96574 0
65 7 y3 57.74918 1
66 8 y3 60.69951 0
67 9 y3 60.07885 1
68 10 y3 73.77607 1
69 11 y3 60.37918 0
70 12 y3 36.42082 1
71 13 y3 42.45131 1
The pigs were measured during a timeperiod (y1-y3), and the treatment was initialized in some of the pigs at time y3. This is indicated as behA
As this being a biological trial the random effect should be each individual and then time and behA should be fixed effects. Like this:
lme(fixed=measurement~time+behA, random= ~1|id, na.action=na.exclude, method="REML", data = long_all)
Would you need an interaction between time and behA? Or does this seem sufficient?