重复测量 ANOVA
在上一个练习中,您看到配对 t 检验比常规 t 检验更有力。本练习将展示统计方法如何推广。首先,您将看到配对 t 检验是重复测量 ANOVA 的一个特例。接着,您将通过在 R 中使用 lmer() 看到,重复测量 ANOVA 又是混合效应模型的一个特例。
本练习的第一部分是把两 个向量的模拟数据转换为 data.frame()。第二部分将带您查看模型结果,理解它们的差异。第三部分将带您查看模型的输出并比较结果。
本练习是课程的一部分
R 中的分层与混合效应模型
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create the data.frame, using the variables from the previous exercise.
# y is the joined vectors before and after.
# trial is the repeated names before and after, each one repeated n_ind
# ind is the letter of the individual, repeated 2 times (because there were two observations)
dat <- data.frame(y = c(___, ___),
trial = rep(c("before", "after"), each = ___),
ind = rep(letters[1:n_ind], times = ___))