我想对配对样本进行 wilcoxon 测试,我想知道我的代码对于我想要测试的内容是否正确。我想知道我的因变量平均湿度(=Feuchte)和我的由水壶孔(Soll)分组的独立变量距离(=Transtyp)之间是否存在显着差异。假设是,随着距离的增加,每个壶孔的水分显着减少。
这是我的数据框
df <- structure(list(Datum = structure(c(18703, 18703, 18703, 18703,
18724, 18724, 18724, 18724, 18730, 18730, 18730, 18730, 18744,
18744, 18744, 18744, 18758, 18758, 18758, 18758, 18774, 18774,
18774, 18774), class = "Date"), Soll = c("1192", "1192", "149",
"149", "1192", "1192", "149", "149", "1192", "1192", "149", "149",
"1192", "1192", "149", "149", "1192", "1192", "149", "149", "1192",
"1192", "149", "149"), Transtyp = structure(c(1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L), .Label = c("2", "5"), class = "factor"), Feuchte = c(36.15,
36.6518518518519, 37.66, 37.8310344827586, 28.7625, 30.128125,
27.271875, 23.0645161290323, 31.903125, 32.15625, 31.740625,
29.9875, 14.6290322580645, 14.6516129032258, 15.058064516129,
13.159375, 13.675, 13.7896551724138, 12.390625, 9.690625, 16.2586206896552,
17.441935483871, 24.24375, 20.24375)), row.names = c(NA, -24L
), class = c("tbl_df", "tbl", "data.frame"))
到目前为止,这是我的代码:
df %>% ungroup() %>%
split(.$Soll)%>%
map_df( ~broom::tidy(wilcox.test(Feuchte ~ Transtyp, data = .x, paired = T, )), .id = "Soll")
如上所述,我真的在测试我想要测试的东西吗?结果让我感到困惑。另外,我知道您也可以使用“,”而不是“~”。这两者有什么区别,我需要哪一个,为什么?我真的被困住了,我找不到一个好的解释。提前非常感谢!
干杯