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).
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!
Best Answer
This gives the following model:
The answer to your first question is given by inspecting the estimated coefficients for the interaction term:
This will give you the coefficients with their standard errors. A convenient way of getting the answer is:
This snippet will install the package
effects
, and apply the functionEffect()
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
If you provide a sample of your data, I could include the exact commands needed.