我一直使用R运行ezANOVA,然后进行成对比较(pairwise.t.test ...)
一旦运行似乎没有包含输出(?)所以我对此有以下问题:
是否有可能在ezANOVA中为重复测量生成均方误差,如果是这样的话?
还有如何在pairwise.t.test中为df,t和SE生成输出?
对于某些人来说,这可能是非常明显的,但我已经查阅了书籍和在线资源,并且空洞。
一如既往地感谢您的时间。非常感谢。
更新
计算ezANOVA输出中的MSE:
: > Exp2DModel
$ANOVA
Effect DFn DFd SSn SSd F p p<.05 ges
1 (Intercept) 1 24 159.231492 3.1947477 1196.19955 5.453251e-22 * 0.9468257
2 Visual 2 48 1.603228 1.9257323 19.98069 4.861610e-07 * 0.1520259
3 Audio 4 96 1.831761 0.9966656 44.10934 5.788074e-21 * 0.1700122
4 Visual:Audio 8 192 14.230991 2.8253824 120.88409 1.010389e-70 * 0.6141057
: > Exp2DModel$ANOVA$SSd[2]/Exp2DModel$ANOVA$DFd[2]
MSE = [1] 0.04011942
答案 0 :(得分:2)
在回答第二个问题时,如何从pairwise.t.test中提取t值。在我看来,拥有数据的自由度,以及精确的p值将允许您使用qt()函数来确定t值。例如:
myTTests<-pairwise.t.test(vector1,vector2
,p.adjust.method = "none"
)
qt(myTTests[[3]],degreesOfFreedom)
答案 1 :(得分:1)
也许来自ezANOVA帮助信息的这些信息会很有用。
library(ez)
data(ANT)
rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = rt
, wid = subnum
, within = .(cue,flank)
, between = group
)
#Show the ANOVA and assumption tests.
print(rt_anova)
有关更多示例,请参阅this link。
帮助页面指示以下值是输出对象的一部分:
DFn Degrees of Freedom in the numerator (a.k.a. DFeffect).
DFd Degrees of Freedom in the denominator (a.k.a. DFerror).
SSn Sum of Squares in the numerator (a.k.a. SSeffect).
SSd Sum of Squares in the denominator (a.k.a. SSerror).
F F-value.
p p-value (probability of the data given the null hypothesis).
p<.05 Highlights p-values less than the traditional alpha level of .05.
ges Generalized Eta-Squared measure of effect size (see in references below: Bakeman, 2005).
GGe Greenhouse-Geisser epsilon.
p[GGe] p-value after correction using Greenhouse-Geisser epsilon.
p[GGe]<.05 Highlights p-values (after correction using Greenhouse-Geisser epsilon) less than the traditional alpha level of .05.
HFe Huynh-Feldt epsilon.
p[HFe] p-value after correction using Huynh-Feldt epsilon.
p[HFe]<.05 Highlights p-values (after correction using Huynh-Feldt epsilon) less than the traditional alpha level of .05.
W Mauchly's W statistic
这些列应该包含计算MSE所需的大部分原材料......虽然,我实际上并不知道如何在重复测量ANOVA中计算MSE ......
据我所知pairwise.t.test
提供的输出只包含p值。从帮助页面:
attach(airquality)
Month <- factor(Month, labels = month.abb[5:9])
pairwise.t.test(Ozone, Month)
我找到了this post on extracting t-values from pairwise.t.test,这可能会有所帮助。基本上,在帖子中,pairwise.t.test的代码被修改。计算p值的行被注释掉(即# 2 * pt(-abs(t.val), total.degf)
并且他们添加一行来返回t.val
而不是p值。您可以在该代码中看到计算自由度并且因此,你应该能够通过修改代码来返回它们。
使用我链接的帖子中的修改过的paired.t.test,我添加了一点回复total.degf
。如果你愿意,我会留给你包括se.dif。请注意,此代码仅用于示例目的,需要进行一些清理(例如,代码将t.val值识别为p值。这不会很难改变。
my.pairded.t.test <- function (x, g, p.adjust.method =
p.adjust.methods, pool.sd = TRUE,
...)
{
DNAME <- paste(deparse(substitute(x)), "and",
deparse(substitute(g)))
g <- factor(g)
p.adjust.method <- match.arg(p.adjust.method)
if (pool.sd) {
METHOD <- "t tests with pooled SD"
xbar <- tapply(x, g, mean, na.rm = TRUE)
s <- tapply(x, g, sd, na.rm = TRUE)
n <- tapply(!is.na(x), g, sum)
degf <- n - 1
total.degf <- sum(degf)
pooled.sd <- sqrt(sum(s^2 * degf)/total.degf)
compare.levels <- function(i, j) {
dif <- xbar[i] - xbar[j]
se.dif <- pooled.sd * sqrt(1/n[i] + 1/n[j])
t.val <- dif/se.dif
# 2 * pt(-abs(t.val), total.degf) this is commented out
t.val # this is added
}
}
else {
METHOD <- "t tests with non-pooled SD"
compare.levels <- function(i, j) {
xi <- x[as.integer(g) == i]
xj <- x[as.integer(g) == j]
t.test(xi, xj, ...)$statistic # this is changed in case
# pool.sd=F
}
}
PVAL <- pairwise.table(compare.levels, levels(g),
p.adjust.method)
ans <- list(method = METHOD, data.name = DNAME, p.value
= PVAL,
p.adjust.method = p.adjust.method, total.degf=total.degf) # I added the total.degf part
class(ans) <- "pairwise.htest"
ans
}
投入使用。
a<-my.pairded.t.test(Ozone, Month)
a$total.degf