有没有办法在R中指定我的数据中的哪一列是组,哪些是块,以便进行弗里德曼测试?我正在将结果与SPSS进行比较



我会在下面给出一个关于我的数据是如何组织的示例,但每次我使用frieman.test(y=,groups=,blocks=(运行Friedman的时,它都会给我一个错误,即我的数据不是来自一个未复制的完整块设计,尽管它是。

<1><1>//tr>//tr>
score treatment day
10 1 1
20 1 1
40 1 1
7 2 1
100 2 1
58 2 1
98 3 1
89 3 1
40 3 1
70 4 1
10 4
28 4
86 5 1
200 5 1
40 5 1
77 1 2
100 1 2
90 1 2
33 2 2
15 2
25 2 2
23 3 2
54 3 2
67 3 2
1 4 2
2 4 2
400 4 2
16 5
10 5
90 5 2

我们可以通过取"分数"的mean来总结数据,然后在friedman.test中使用总结的数据

sample_data1 <- aggregate(score ~ ., sample_data, FUN = mean)
friedman.test(sample_data1$score, groups = sample_data1$treatment, 
blocks = sample_data1$day)

最新更新