I have data from patients treated with 2 different kinds of treatments during surgery. I need to analyze its effect on heart rate. The heart rate measurement is taken every 15 minutes.
Given that the surgery length can be different for each patient, each patient can have between 7 and 10 heart rate measurements. So an unbalanced design should be used. I'm doing my analysis using R. And have been using the ez package to do repeated measure mixed effect ANOVA. But I do not know how to analyse unbalanced data. Can anyone help?
Suggestions on how to analyze the data are also welcomed.
Update:
As suggested, I fitted the data using the lmer
function and found that the best model is:
heart.rate~ time + treatment + (1|id) + (0+time|id) + (0+treatment|time)
with the following result:
Random effects:
Groups Name Variance Std.Dev. Corr
id time 0.00037139 0.019271
id (Intercept) 9.77814104 3.127002
time treat0 0.09981062 0.315928
treat1 1.82667634 1.351546 -0.504
Residual 2.70163305 1.643665
Number of obs: 378, groups: subj, 60; time, 9
Fixed effects:
Estimate Std. Error t value
(Intercept) 72.786396 0.649285 112.10
time 0.040714 0.005378 7.57
treat1 2.209312 1.040471 2.12
Correlation of Fixed Effects:
(Intr) time
time -0.302
treat1 -0.575 -0.121
Now I'm lost at interpreting the result. Am I right in concluding that the two treatments differed in affecting heart rate? What does the correlation of -504 between treat0 and treat1 means?