【问题标题】:partial eta squared error部分 eta 平方误差
【发布时间】:2017-10-20 11:13:08
【问题描述】:

我有一个包含 3 个因素的均值表 av.rt:主题 (N=28)、奖励(奖励或非奖励)、一致性(一致或不一致)和数值 -反应时间。我的表有 108 个观察值,适用于所有主题/奖励/一致性组合。

> dput(av.rt)
structure(list(Reward = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L), .Label = c("R", "U"), class = "factor"), 
   Congruency = structure(c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 
1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 
2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 
1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 
2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L), .Label = c("con", 
"inc"), class = "factor"), Subject = structure(c(1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 
5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 
9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 12L, 
12L, 12L, 12L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 15L, 
15L, 15L, 15L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 18L, 
18L, 18L, 18L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 21L, 
21L, 21L, 21L, 22L, 22L, 22L, 22L, 23L, 23L, 23L, 23L, 24L, 
24L, 24L, 24L, 25L, 25L, 25L, 25L, 26L, 26L, 26L, 26L, 27L, 
27L, 27L, 27L), .Label = c("9", "11", "12", "13", "14", "15", 
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", 
"26", "27", "28", "29", "30", "31", "32", "33", "34", "35", 
"36"), class = "factor"), TTime.Shifted = c(565.618181818182, 
605.669565217391, 554.683333333333, 655.486956521739, 577.247619047619, 
631.409523809524, 591.419047619048, 757.270588235294, 520.191304347826, 
607.617391304348, 495.290909090909, 648.842105263158, 500.9, 
585.945454545455, 521.105882352941, 768.8, 553.009090909091, 
622.078260869565, 564.636363636364, 696.094736842105, 484.6, 
553.739130434783, 636.657142857143, 635.817391304348, 618.017391304348, 
713.145454545455, 600.533333333333, 857.61, 437.582608695652, 
526.572727272727, 445.390476190476, 531.345454545455, 565.104347826087, 
613.746666666667, 609.714285714286, 614.87, 566.716666666667, 
687.99, 588.694736842105, 655.555555555556, 462.53, 726.34, 
611.8625, 803.2, 485.234782608696, 609.284210526316, 504.2, 
647.46, 471.226086956522, 554.741666666667, 506.62, 631.009523809524, 
617.991304347826, 623.252173913044, 655.895652173913, 659.85, 
605.318181818182, 580.947826086957, 619.675, 657.857142857143, 
523.22, 626.976470588235, 565.233333333333, 711.336842105263, 
455.716666666667, 533.818181818182, 464.5, 663.505263157895, 
549.172727272727, 608.85, 579.2, 602.952941176471, 646.383333333333, 
626, 732.555555555556, 663.91, 469.48, 578.095238095238, 
568.694736842105, 620.922222222222, 571.37, 603.386666666667, 
650.109090909091, 632.233333333333, 584.363636363636, 643.811111111111, 
594.961904761905, 723.82, 515.845454545455, 526.75652173913, 
594.647619047619, 545.878260869565, 541.38, 550.15652173913, 
538.778947368421, 618.175, 539.219047619048, 563.842105263158, 
539.12380952381, 684.018181818182, 430.217391304348, 590.85, 
439.547826086957, 605.634782608696, 591.933333333333, 673.742857142857, 
633.441666666667, 762.022222222222)), .Names = c("Reward", 
"Congruency", "Subject", "TTime.Shifted"), row.names = c(NA, 
-108L), class = "data.frame")

我运行一个 rANOVA 和一个函数来计算 eta 平方:

aov_CSRA <- with(av.rt, aov(TTime.Shifted ~ Reward*Congruency + Error(Subject / (Reward*Congruency))))
summary(aov_CSRA)
library(lsr)
etaSquared( aov_CSRA )    

但是,我得到一个错误:

Error in etaSquared(aov_CSRA) : "x" must be a linear model object

我该如何解决?

【问题讨论】:

  • 使用dput(av.rt) 发布数据集示例,etaSquared 来自哪里?始终通过调用 library() 来启动使用非基本 R 函数的代码。另外,aov 不需要with,使用参数data。
  • 我编辑了,谢谢
  • 你模型的输出不是aov类的对象,也不是lm,class(aov_CSRA) [1] "aovlist" "listof"类的对象。
  • 我认为这是函数中的错误。从帮助页面? etaSquared,部分Warning: This package is under development, and has been released only due to teaching constraints. 发邮件给包维护者可能会更好。
  • 我明白了,谢谢!似乎作者的电子邮件无效,所以我无法联系他......关于如何计算 eta 平方还有其他方法吗?在 R 中这似乎不是很简单的问题...

标签: r summary anova


【解决方案1】:

在谷歌快速搜索后,我发现有另一个包具有计算函数eta squared、包DescTools、函数EtaSq。

library(DescTools)

aov_CSRA <- aov(TTime.Shifted ~ Reward*Congruency + Error(Subject / (Reward*Congruency)), data = av.rt)
summary(aov_CSRA)

EtaSq(aov_CSRA, type = 1, anova = FALSE)
#                       eta.sq eta.sq.part eta.sq.gen
#Reward            0.281762511   0.6430538 0.31363362
#Congruency        0.094438684   0.7177132 0.13281446
#Reward:Congruency 0.007180224   0.1280018 0.01151048

EtaSq(aov_CSRA, type = 1, anova = TRUE)
#                       eta.sq eta.sq.part eta.sq.gen         SS df         MS
#Reward            0.281762511   0.6430538 0.31363362 193165.658  1 193165.658
#Congruency        0.094438684   0.7177132 0.13281446  64743.569  1  64743.569
#Reward:Congruency 0.007180224   0.1280018 0.01151048   4922.489  1   4922.489
#                        SSE dfE         F            p
#Reward            107222.34  26 46.840119 2.895631e-07
#Congruency         25464.56  26 66.104912 1.304265e-08
#Reward:Congruency  33533.93  26  3.816574 6.158667e-02

第一次尝试就成功了。
请注意,我已将呼叫更改为 aov 一点点。而不是with,我使用aov 参数data。我发现它使代码更具可读性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-25
    • 2021-08-26
    • 2016-08-20
    • 2017-08-26
    • 1970-01-01
    • 2019-07-10
    • 1970-01-01
    相关资源
    最近更新 更多