首先,这个数据集在 t 检验中是不是很整齐?
https://i.stack.imgur.com/tMK6R.png
其次,我正在尝试进行双样本 t 检验,以比较治疗 a 和 b 的时间 3 的“结果 1”的平均值。我该怎么做呢?
样本数据:
df <- structure(list(code = c(100, 100, 100, 101, 101, 101, 102, 102,
102, 103, 103, 103), treatment = c("a", "a", "a", "b", "b", "b",
"a", "a", "a", "b", "b", "b"), sex = c("f", "f", "f", "m", "m",
"m", "f", "f", "f", "f", "f", "f"), time = c(1, 2, 3, 1, 2, 3,
1, 2, 3, 1, 2, 3), `outcome 1` = c(21, 23, 33, 44, 45, 47, 22,
34, 22, 55, 45, 56), `outcome 2` = c(21, 32, 33, 33, 44, 45,
22, 57, 98, 65, 42, 42), `outcome 3` = c(62, 84, 63, 51, 45,
74, 85, 34, 96, 86, 45, 47)), .Names = c("code", "treatment",
"sex", "time", "outcome 1", "outcome 2", "outcome 3"),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -12L))