弗里德曼测试错误,可能是错误测试? [英] Friedman test error, possibly wrong test?

查看:30
本文介绍了弗里德曼测试错误,可能是错误测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下数据:

df<-structure(list(participant_id = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L), 
.Label = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"), class = "factor"), 
tool = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), 
.Label = c("pig", "silicone", "sponge"), class = "factor"), 
value = c(1, 3, 2, 4, 2, 1, 4, 3, 4, 4, 3, 1, 3, 2, 3, 2, 1, 2, 3, 4, 3, 2, 2, 2, 2, 1, 1, 4, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 1, 1, 1, 1, NA, 2, 1, 2, 4, 1, 1, 2, 5, 4, 4, 3, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 5, 4, 3, 3, 2, 4, 4, 3, 5)),
row.names = c(NA, -96L), class = c("tbl_df", "tbl", "data.frame"))

它的 32 名左右的学生被要求以 1 到 5 个李克特类型的量表对三个不同的对象(工具"栏)进行评分(价值"栏).

Its 32 or so students who were asked to rate three different objects (the "tool" column) on a 1-5 likert-type scale how well they liked it (the "value" column).

所以我们的想法是比较三种类型的工具,看看学生喜欢它的分数在统计上是否不同.

So the idea is to compare the three types of tools and see if the scores of how well the students liked it are statistically different.

最初我想用 kruskal-wallis 测试来比较组,但有人向我指出,因为这是一个学科内设计,学生自己对所有三个对象进行评分,我应该使用弗里德曼测试.

Originally I was thinking kruskal-wallis test to compare the groups, but it was pointed out to me that because this is a within-subjects design and the students themselves rate all three objects, I should use a Friedman-test.

所以我运行这段代码:

 test.fried<-df%>%friedman_test(value~tool|participant_id)

我收到此错误:

" Friedman.test.default(c(1, 3, 2, 4, 2, 1, 4, 3, 4, 4, 3, 1, 3, :不是未复制的完整块设计"

"Error in friedman.test.default(c(1, 3, 2, 4, 2, 1, 4, 3, 4, 4, 3, 1, 3, : not an unreplicated complete block design"

现在已询问此错误:此处此处,所以我查看了列出的评论.

Now this error has been asked about: here and here, so I looked into the comments listed.

  • 我确保我的组被编码为因素
  • 我做了 table(df$participant_id,df$tool) 以确保我没有遗漏组合或加倍组合.
  • I made sure my groups were coded as factors
  • I did table(df$participant_id,df$tool) to make sure I didn't have missing combinations or doubled up combinations.

我是否遗漏了一些明显的东西?这甚至是正确的测试吗?

Am I missing something obvious? Is this even the right test?

推荐答案

您在 participant_id 中的 value 缺失值 25 用于海绵,因此您必须估算一个值,或删除该参与者.删除很简单:

You have a missing value for value in participant_id 25 for sponge so you will have to impute a value, or remove that participant. Removing is simple:

df.sub <- subset(df, subset=df$participant_id != 25)
df.sub <- drop.levels(df.sub)
friedman.test(value~tool | participant_id, df.sub)
# 
#   Friedman rank sum test
# 
# data:  value and tool and participant_id
# Friedman chi-squared = 42.596, df = 2, p-value = 5.627e-10

注意.您不必将 participant_id 作为一个因素.如果是数值则更容易删除:

Note. You did not have to make participant_id a factor. It is easier to drop if it is a numeric value:

df$participant_id <- as.numeric(df$participant_id) 
friedman.test(value~tool | participant_id, df, subset=participant_id != 25)
# 
#   Friedman rank sum test
# 
# data:  value and tool and participant_id
# Friedman chi-squared = 42.596, df = 2, p-value = 5.627e-10

这篇关于弗里德曼测试错误,可能是错误测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆