I am analyzing data for a repeated measures study with missing data. For example here is a 3 X 3 experimental design with three conditions and 3-time measures:

Example data

I am using a mixed model for the main effects:

 model1 <- lme(outcomeMeasure ~ condition * time, random = ~1|subject/condition/time, data = exampleData)

                            numDF denDF  F-value p-value
    (Intercept)                 1    57 892.3397  <.0001
    condition                   2    21   1.6985  0.2066
    time                        2    57   4.5983  0.0363
    condition:time              2    36   0.1513  0.8601

Since time is significant, I would like to follow up with a paired test by averaging across condition to obtain values of each subject's time. As you can see in the example data above, subject 1 is missing an entire condition. When I aggregate the data across time:

timeSubjectMeans <- aggregate(value ~ Subject * time, data = exampleData, FUN = mean)

aggregated data

In order to perform a paired t-test on this data, should I exclude subject 1 because they are missing 1 of the conditions?

  • $\begingroup$ For the random effect part, do you know what random = ~1|subject/condition/time means? $\endgroup$
    – user158565
    Nov 27 '18 at 21:31
  • $\begingroup$ This defines the multilevel structure of the model's random factor subject. Within each subject are the levels of condition, and within each condition are the levels of time. $\endgroup$ Nov 27 '18 at 22:02
  • $\begingroup$ We use the random effect to incorporate the correlation duo to the repeated measures. I am afraid your random specification specifies the independent among response variables. $\endgroup$
    – user158565
    Nov 27 '18 at 22:06
  • $\begingroup$ Thank you for the response. Are you saying condition and time should not be in the random effect of the model? I've seen models that are just a random intercept for the subject: random = ~1|subject. $\endgroup$ Nov 27 '18 at 22:15
  • $\begingroup$ subject/condition/time means each obs has its own random effect? if it is true, you specified they are independent. If you use random = ~1|subject, it specifies that 9 obs from the same subject are correlated with the same correlation coefficient. The obs from different subjects are independent. It it is what you want, it is correct. $\endgroup$
    – user158565
    Nov 27 '18 at 22:42

With regard to the missing data, the mixed model will give you correct inferences under the more plausible missing at random assumption whereas the t-test only under the more stringent missing completely at random assumption.

Hence, it would be advisable to perform such comparisons via the mixed model, using, e.g., the emmeans package.

  • $\begingroup$ Hello Dimitris! Thank you very much for the response. I was previously using the lsmeans R package, which I believe has been retired and replaced by the emmeans package. Could you please explain what this function does? It calculates the estimated marginal means? Is there any other description needed when reporting the use of this method in a report or paper in a data analysis section? $\endgroup$ Nov 28 '18 at 17:02
  • $\begingroup$ Indeed this package provides an easy manner to calculate and test effects of interest from fitted models. The method behind the package does not have a particular name other than calculating means from a fitted model. $\endgroup$ Nov 28 '18 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.