4
$\begingroup$

I am very new to linear mixed effect models, but know I will need them to deal with some of my data. I'm having a hard time finding the exact model to pick and extracting the information from them, hence my post here.

I am trying to model the data below using R and lme4. In this experiment a certain parameter was measured over time in two distinct conditions (called WT and KO here). This experiment was repeated three times per condition on different subjects (biological replicates) and for each subject, the measurement was done multiple times (technical replicates). In other words, each data point is defined a set of 4 values (Experiment, Condition, Time, Measurement).

enter image description here

What I would like to know is:

  • Is there a different time dependence of the measurements for condition WT and KO?
  • What is the corresponding p-value of this difference?
  • What are the model corrected time slopes and their standard errors for condition WT and KO respectively?

I would really appreciate some help, preferably using lme4 notation. Many thanks!

$\endgroup$
2
  • $\begingroup$ You should ask only one question per thread if you want to maximize your chances of getting an answer $\endgroup$
    – Antoine
    Commented Oct 24, 2015 at 8:50
  • 1
    $\begingroup$ Thanks @Antoine, but the questions are very related. I am quite sure all answers can be given using just a few lines of R code. $\endgroup$
    – savantas
    Commented Oct 24, 2015 at 11:09

1 Answer 1

6
$\begingroup$
  • The effect of time is allowed to vary between conditions by means of the interaction term Condition * Time
  • You need a random part for the subjects, I call it subjectID below, to get an random intercept per subject.
  • Since all levels of the "experiment" factor is in the data, (exp1, exp2 and exp3), and there are only three levels of that factor, you should treat it as a fixed term.

This gives the following model:

fm <- lmer(Measurement ~ 1 + Time * Condition + exp + (1 | subjectID), data = your.data.frame)

The answer to your first question is given by inspecting the estimated coefficients for the interaction term:

summary(fm)

This will give you the coefficients with their standard errors. A convenient way of getting the answer is:

install.packages("effects")
library("effects")
my.eff <- Effect(c("Condition", "Time"), fm)
plot(my.eff)

This snippet will install the package effects, and apply the function Effect() from that package.

The answer to the second question is given directly in the output of summary(fm): it would be the p-value of the interaction. If "WT" is the reference level of "Condition", then the relevant coefficient would be "Time*Condition:KO".

The third question requires some calculations, especially for the value of "Condition" which is not the reference level. You need to add the coefficients, and calculate the variance of the sum using the formula for the sum of weighted normally distributed random variables

Or you can extract the confidence interval from the object my.eff

summary(my.eff)

If you provide a sample of your data, I could include the exact commands needed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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