[英]Explanation of random term syntax in nlme::lme()
I am trying to determine whether there is a significant effect of treatment
on microbiome diversity
between two timepoints
(two timepoints x three treatments).我正在尝试确定治疗是否对两个
timepoints
(两个时间点 x 三个treatment
)之间的微生物组diversity
有显着影响。
Can somebody please explain how to model this using linear mixed models using the nlme
library in R
?有人可以解释一下如何使用 R 中的
nlme
库使用线性混合模型R
吗?
Particularly how to handle repeated sampling of the same subject over time.特别是如何随着时间的推移处理同一主题的重复采样。
I have seen the three following syntaxes used but don't really understand the difference between them.我已经看到使用了以下三种语法,但并不真正理解它们之间的区别。
model1 <- lme(diversity ~ treatment * timepoint,
random = ~ 1 | mouseID,
data = alpha_df)
model2 <- lme(diversity ~ treatment * timepoint,
random = ~ timepoint | mouseID,
data = alpha_df)
model3 <- lme(shannon ~ treatment * timepoint,
random = ~ 1 + timepoint | mouse,
data = alpha_df)
I think model3 is the correct one for my use but I am not sure.我认为model3 适合我使用,但我不确定。
Thanks in advance!提前致谢!
~ 1 | mouse
~ 1 | mouse
means "one intercept per mouse". ~ 1 | mouse
意思是“每只鼠标一次拦截”。 There is a main, fixed intercept (actually there are three intercepts, one per treatment), and the random intercepts of the mice are normally distributed around the main intercept.有一个主要的固定截距(实际上有三个截距,每个处理一个),小鼠的随机截距正态分布在主要截距周围。
~ timepoint | mouse
~ timepoint | mouse
is the same as ~ 1 + timepoint | mouse
~ timepoint | mouse
与~ 1 + timepoint | mouse
相同~ 1 + timepoint | mouse
. ~ 1 + timepoint | mouse
。 It means "one regression line (ie an intercept and a slope) per mouse".它意味着“每只鼠标一条回归线(即截距和斜率)”。 There is a main slope (actually three main slopes because of the interaction term with the treatments) and the random slopes are normally distributed around the main slope.
有一个主斜坡(实际上是三个主斜坡,因为与处理的交互项),随机斜坡通常分布在主斜坡周围。
So the "biggest" model is ~ 1 + timepoint | mouse
所以“最大的”model 是
~ 1 + timepoint | mouse
~ 1 + timepoint | mouse
. ~ 1 + timepoint | mouse
。 If there is a biological justification that the mice have the same diversity value at time 0, you can drop the intercept: random = ~ 0 + timepoint
.如果有生物学理由表明小鼠在时间 0 具有相同的多样性值,则可以放弃截距:
random = ~ 0 + timepoint
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.