重复测量方差分析 - SPSS 与 R 的不同结果 [英] Repeated measures ANOVA - different resutls for SPSS versus R

查看:59
本文介绍了重复测量方差分析 - SPSS 与 R 的不同结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重复运行 - 使用 R 测量方差分析并将其与 SPSS 输出进行比较,结果差异很大!也许我在某处犯了错误,但我无法弄清楚所以一些示例数据:id 是主题.每个主题对三个项目(res_1、res_2 和 res_3)进行一次评分.我想比较一下 item 的整体效果.

I am trying to run a repeated - measures ANOVA using R and compared it to the SPSS output and results differ a lot! Maybe I make a mistake somewhere, but I cannot figure it out So some sample data: id is the subject. Every subject makes one rating for three items (res_1, res_2 and res_3). I want to compare an overall effect of item.

id<-c(1,2,3,4,5,6)
res_1<-c(1,1,1,2,2,1)
res_2<-c(4,5,2,4,4,3)
res_3<-c(4,5,6,3,6,6)
## wide format for spss
table<-as.data.frame(cbind(id, res_1, res_2, res_3))
## reshape to long format
library(reshape2)
table<-melt(table, id.vars="id")
colnames(table)<-c("id", "item", "rating")
aov.out = aov(rating ~ item+ Error(id/item), data=table) 
summary(aov.out)

这是我的 SPSS 代码(来自宽格式数据)

And here is my SPSS code (from wide format data)

GLM item_1 item_2 item_3
/WSFACTOR=factor1 3 Polynomial 
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE 
/CRITERIA=ALPHA(.05)
/WSDESIGN=factor1.

我得到的结果R:p 值 0.0526(误差:范围内)和 SPSS:p 值 0.003(受试者内效应检验)

The results I get from R: p value 0.0526 (error:within) and SPSS: p value 0.003 (test of within subject effect)

有没有人有可以解释差异的建议?如果我进行非参数 Friedmann 检验,我会在 SPSS 和 R 中得到相同的结果.实际上,在查看我的数据时,summary(aov.out) 与 SPSS 的受试者内对比测试"相同(但我学会了查看受试者内效应的测试).

Does anyone have a suggestion that may explain the difference? If I do a non-parametric Friedmann test, I get the same results in SPSS and R. Actually, when looking at my data, the summary(aov.out) is the same as SPSS's "test of within subjects contrast" (but I learned to look at the test of within subjects effect).

谢谢!

推荐答案

那里有很多东西;我有点惊讶,你的spss 与 R anova"的谷歌没有给你带来解释 SPSS(III 型)和 R(I 型)之间的平方和差异以及差异的链接如何处理对比.

There's a lot of stuff out there; I am a bit surprised that your google for 'spss versus R anova' did not bring you to links explaining about the difference in sums-of-squares between SPSS (type-III) and R (type-I) as well as difference in how contrasts are handled.

这是我发现的前两个结果:http://myowelt.blogspot.ca/2008/05/obtaining-same-anova-results-in-r-as-in.htmlhttps://stats.stackexchange.com/questions/40958/testing-anova-hypothesis-with-contrasts-in-r-and-spss

These are the top two results that I found: http://myowelt.blogspot.ca/2008/05/obtaining-same-anova-results-in-r-as-in.html and https://stats.stackexchange.com/questions/40958/testing-anova-hypothesis-with-contrasts-in-r-and-spss

这篇关于重复测量方差分析 - SPSS 与 R 的不同结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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