如何使用testInteractions
包中的phia
函数与最新版本的afex
(ez.glm
,现在为aov_ez
)?
虽然这在v0.3中直接起作用,但它已不再适用于v0.4。
答案 0 :(得分:0)
以为我会在这里发布解决方案,因为我有一段时间困惑为什么基于v.03的脚本在更新后不再运行。
解决方案很简单,idata(由phia
使用)不再输出为model$idata
,而是现在位于model$Anova$idata
。只需修改testInteractions
语法即可。
工作示例
# Run the old way, to illustrate method
remove.packages('afex')
install.packages("http://www2.uaem.mx/r-mirror/src/contrib/Archive/afex/afex_0.3-42.tar.gz",repos=NULL, type='source')
require(afex)
packageDescription('afex')
data("obk.long")
head(obk.long)
a<-
ez.glm("id", "value", obk.long, within = c("phase", "hour"), print.formula = TRUE, return='full')
a
nice.anova(a$Anova)
#Run a contrast with phia
install.packages('phia')
require('phia')
testInteractions(a$lm, pairwise = "phase", idata=a$idata)
# Now, with the latest afex
detach("package:afex", unload=TRUE)
install.packages('afex')
require(afex)
packageDescription('afex')
b<-aov_ez("id", "value", obk.long, within = c("phase", "hour"), print.formula = TRUE)
b
# This issue here is that no idata comes out of aov_ez in its latest version, so scripts no longer work...
testInteractions(b$lm, pairwise = "phase", idata=b$idata)
# The data is, however, nested in the Anova table...
testInteractions(b$lm, pairwise = "phase", idata=b$Anova$idata)