2017-10-20 3 views
0

Ich habe eine Tabelle der Mittel av.rt mit 3 Faktoren: Betreff (N = 28), Belohnung (belohnt oder nicht belohnt), Kongruenz (kongruent oder inkongruent) und numerische Werte - Reaktion mal. Meine Tabelle enthält 108 Beobachtungen für alle Kombinationen aus Betreff, Belohnung und Kongruenz.teilweise Eta Quadrat Fehler

> 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") 

Ich betreibe ein rANOVA und ein fucntion die eta zu berechnen Quadrat:

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

Allerdings habe ich einen Fehler:

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

Wie kann ich es beheben?

+0

Veröffentlichen Sie ein Datasetbeispiel mit 'dput (av.rt)' und woher kommt 'etaSquared'? Starten Sie den Code, der Nicht-Basis-R-Funktionen verwendet, immer mit einem Aufruf von 'library()'. Wenn Sie 'aov' nicht benötigen, verwenden Sie das Argument' data'. –

+0

Ich habe es bearbeitet, danke – MariKo

+0

Die Ausgabe Ihres Modells ist kein Objekt der Klasse 'aov' noch Klasse' lm', 'Klasse (aov_CSRA) [1]" aovlist "" listof "'. –

Antwort

1

Nach einer schnellen Google-Suche fand ich heraus, dass es ein anderes Paket mit einer Funktion zum Berechnen eta squared, Paket DescTools, Funktion EtaSq gibt.

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 

Und es funktionierte beim ersten Versuch.
Beachten Sie, dass ich den Anruf zu aov ein wenig geändert habe. Anstelle von with verwende ich aov Argument data. Ich finde es, dass es den Code lesbarer macht.