重複量數 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 = ___))