lm.fitx,y,偏移=偏移,singular.ok = singular.ok,...中的错误:重复测量方差分析中为0非NA

问题描述

我一直在遇到相同的错误,一次又一次尝试使用rstatix包中的anova_test做一种重复测量ANOVA的方法。这是我的数据 https://github.com/gyrusrectus/stackquery/blob/master/s2.csv代码

anova_test(data=s2,dv = mean_score,wid = id,within = station)

我想比较三个不同任务工作站上候选人的平均分数。请帮忙。

解决方法

这似乎是anova_test中的错误。如果数据框包含模型中未包含的变量,则会引发错误。如果将它们放下,它将按预期工作:

s2 <- read.csv("https://raw.githubusercontent.com/gyrusrectus/stackquery/master/s2.csv")
s2 <- s2[,c(1,2,7)]

anova_test(data = s2,dv = mean_score,wid = cand_id,within = station)
#> 
#> ANOVA Table (type III tests)
#> 
#> $ANOVA
#>    Effect DFn DFd   F        p p<.05   ges
#> 1 station   2  42 8.8 0.000643     * 0.157
#> 
#> $`Mauchly's Test for Sphericity`
#>    Effect     W     p p<.05
#> 1 station 0.859 0.219      
#> 
#> $`Sphericity Corrections`
#>    Effect   GGe      DF[GG] p[GG] p[GG]<.05  HFe     DF[HF]    p[HF] p[HF]<.05
#> 1 station 0.876 1.75,36.81 0.001         * 0.95 1.9,39.89 0.000819         *