在R中使用aov时的summary.lm输出 [英] summary.lm output when using aov in R

查看:182
本文介绍了在R中使用aov时的summary.lm输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关赏金: 250个声望点.

我对summary.lm()输出有疑问.

首先,这是我的数据集的可复制代码:

Cond_Per_Row_stats<-structure(list(Participant = structure(c(1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 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, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1200ms", 
    "50ms"), class = "factor"), Condition = structure(c(21L, 
    21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L, 
    22L, 22L, 22L, 22L, 22L, 22L, 22L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 11L, 
    11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 
    12L, 12L, 12L, 12L, 12L, 12L, 12L, 25L, 25L, 25L, 25L, 25L, 
    25L, 25L, 25L, 25L, 25L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 
    26L, 26L, 26L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 15L, 15L, 15L, 15L, 15L, 
    15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 
    16L, 16L, 16L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 
    23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 
    4L, 4L, 4L, 4L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
    13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 29L, 
    29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 
    30L, 30L, 30L, 30L, 30L, 30L, 30L, 9L, 9L, 9L, 9L, 9L, 9L, 
    9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
    10L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 
    20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 27L, 27L, 27L, 
    27L, 27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 
    28L, 28L, 28L, 28L, 28L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
    7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 17L, 17L, 
    17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 
    18L, 18L, 18L, 18L, 18L, 18L), .Label = c("P0.0np1200.0", 
    "P0.0np50.0", "P3np1200.0", "P3np50.0", "P35np1200.0", "P35np50.0", 
    "P4np1200.0", "P4np50.0", "P45np1200.0", "P45np50.0", "P0.0tp1200.0", 
    "P0.0tp50.0", "P3tp1200.0", "P3tp50.0", "P35tp1200.0", "P35tp50.0", 
    "P4tp1200.0", "P4tp50.0", "P45tp1200.0", "P45tp50.0", "P0.0fp1200.0", 
    "P0.0fp50.0", "P3fp1200.0", "P3fp50.0", "P35fp1200.0", "P35fp50.0", 
    "P4fp1200.0", "P4fp50.0", "P45fp1200.0", "P45fp50.0"), class = "factor"), 
    Accuracy = c(0.785398163397448, 0.523598775598299, 0.785398163397448, 
    0.523598775598299, 0.785398163397448, 0.869122203007293, 
    0.955316618124509, 0.785398163397448, 0.615479708670387, 
    0.701674123787604, 1.15026199151093, 1.15026199151093, 0.869122203007293, 
    0.523598775598299, 0.701674123787604, 0.701674123787604, 
    0.955316618124509, 0.701674123787604, 0.955316618124509, 
    0.615479708670387, 0.955316618124509, 0.785398163397448, 
    0.701674123787604, 0.869122203007293, 0.785398163397448, 
    0.615479708670387, 0.615479708670387, 0.869122203007293, 
    0.701674123787604, 0.615479708670387, 1.0471975511966, 0.869122203007293, 
    0.615479708670387, 0.615479708670387, 0.869122203007293, 
    0.701674123787604, 0.701674123787604, 0.869122203007293, 
    0.785398163397448, 0.869122203007293, 1.0471975511966, 0.955316618124509, 
    0.523598775598299, 1.0471975511966, 0.615479708670387, 0.955316618124509, 
    0.615479708670387, 0.785398163397448, 0.955316618124509, 
    0.785398163397448, 0.701674123787604, 0.615479708670387, 
    0.615479708670387, 0.955316618124509, 0.869122203007293, 
    0.869122203007293, 1.0471975511966, 0.785398163397448, 0.701674123787604, 
    0.785398163397448, 1.0471975511966, 0.911738290968488, 1.00028587904971, 
    0.827113206702756, 0.785398163397448, 1.00028587904971, 1.09681145610345, 
    1.00028587904971, 1.0471975511966, 1.09681145610345, 1.0471975511966, 
    0.827113206702756, 1.0471975511966, 0.420534335283965, 0.659058035826409, 
    1.0471975511966, 0.869122203007293, 1.0471975511966, 0.869122203007293, 
    0.785398163397448, 1.09681145610345, 0.785398163397448, 0.955316618124509, 
    0.911738290968488, 0.911738290968488, 1.00028587904971, 1.20942920288819, 
    1.15026199151093, 1.00028587904971, 1.20942920288819, 1.09681145610345, 
    1.0471975511966, 0.911738290968488, 0.827113206702756, 1.00028587904971, 
    0.969532110115768, 1.09681145610345, 1.00028587904971, 0.785398163397448, 
    1.09681145610345, 1.09681145610345, 0.869122203007293, 0.743683120092141, 
    0.869122203007293, 0.869122203007293, 1.0471975511966, 1.00028587904971, 
    1.09681145610345, 1.36522739563372, 1.00028587904971, 1.15026199151093, 
    0.869122203007293, 0.570510447745185, 1.20942920288819, 1.0471975511966, 
    0.955316618124509, 0.827113206702756, 1.00028587904971, 1.00028587904971, 
    1.0471975511966, 0.955316618124509, 0.911738290968488, 0.911738290968488, 
    0.570510447745185, 0.869122203007293, 1.00028587904971, 0.869122203007293, 
    0.785398163397448, 0.911738290968488, 0.869122203007293, 
    0.785398163397448, 0.701674123787604, 1.00028587904971, 0.420534335283965, 
    0.570510447745185, 0.969532110115768, 0.869122203007293, 
    0.911738290968488, 1.0471975511966, 0.785398163397448, 0.955316618124509, 
    0.827113206702756, 0.827113206702756, 0.659058035826409, 
    0.955316618124509, 0.701674123787604, 0.785398163397448, 
    0.785398163397448, 1.09681145610345, 1.0471975511966, 0.869122203007293, 
    0.827113206702756, 0.911738290968488, 0.827113206702756, 
    0.785398163397448, 0.827113206702756, 1.00028587904971, 0.911738290968488, 
    1.09681145610345, 0.955316618124509, 0.955316618124509, 1.15026199151093, 
    0.785398163397448, 0.955316618124509, 0.911738290968488, 
    1.0471975511966, 0.869122203007293, 0.869122203007293, 0.911738290968488, 
    0.955316618124509, 0.955316618124509, 0.827113206702756, 
    0.785398163397448, 0.869122203007293, 0.955316618124509, 
    0.684719203002283, 0.827113206702756, 1.00028587904971, 0.785398163397448, 
    0.827113206702756, 1.27795355506632, 1.20942920288819, 1.27795355506632, 
    1.00028587904971, 0.869122203007293, 1.15026199151093, 1.36522739563372, 
    1.27795355506632, 1.5707963267949, 1.5707963267949, 1.5707963267949, 
    1.27795355506632, 1.20942920288819, 0.911738290968488, 0.659058035826409, 
    1.36522739563372, 1.20942920288819, 1.36522739563372, 1.36522739563372, 
    1.27795355506632, 1.20942920288819, 1.0471975511966, 1.15026199151093, 
    1.15026199151093, 0.869122203007293, 1.27795355506632, 1.36522739563372, 
    1.27795355506632, 1.09681145610345, 1.36522739563372, 1.27795355506632, 
    1.00028587904971, 1.27795355506632, 1.15026199151093, 1.00028587904971, 
    1.36522739563372, 1.09681145610345, 1.15026199151093, 1.15026199151093, 
    1.36522739563372, 1.5707963267949, 1.5707963267949, 0.869122203007293, 
    1.09681145610345, 1.20942920288819, 1.36522739563372, 1.27795355506632, 
    1.27795355506632, 1.36522739563372, 1.5707963267949, 1.5707963267949, 
    1.15026199151093, 0.911738290968488, 1.20942920288819, 1.20942920288819, 
    1.28403977458335, 1.20942920288819, 1.36522739563372, 1.27795355506632, 
    1.36522739563372, 1.20942920288819, 0.911738290968488, 1.20942920288819, 
    1.0471975511966, 0.827113206702756, 1.5707963267949, 1.0471975511966, 
    1.0471975511966, 1.15026199151093, 1.27795355506632, 1.15026199151093, 
    1.00028587904971, 1.20942920288819, 0.659058035826409, 0.785398163397448, 
    1.09681145610345, 1.20942920288819, 0.827113206702756, 1.0471975511966, 
    1.20942920288819, 1.5707963267949, 0.955316618124509, 1.0471975511966, 
    1.0471975511966, 0.869122203007293, 1.20942920288819, 1.27795355506632, 
    1.09681145610345, 1.0471975511966, 1.5707963267949, 1.27795355506632, 
    0.869122203007293, 1.00028587904971, 0.911738290968488, 0.911738290968488, 
    1.00028587904971, 1.20942920288819, 1.20942920288819, 1.00028587904971, 
    1.36522739563372, 1.0471975511966, 1.09681145610345, 0.827113206702756, 
    1.15026199151093, 1.09681145610345, 1.27795355506632, 1.36522739563372, 
    1.36522739563372, 1.36522739563372, 1.15026199151093, 1.27795355506632, 
    0.955316618124509, 0.701674123787604, 1.09681145610345, 1.00028587904971, 
    1.20942920288819, 1.20942920288819, 1.20942920288819, 1.00028587904971, 
    1.36522739563372)), .Names = c("Participant", "Coherence", 
"PrimeType", "PrimeDuration", "Condition", "Accuracy"), row.names = c(20L, 
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 49L, 50L, 51L, 52L, 
53L, 54L, 55L, 56L, 57L, 58L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 
85L, 86L, 87L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 
115L, 116L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L, 
145L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L, 
194L, 195L, 196L, 197L, 198L, 199L, 200L, 201L, 202L, 203L, 223L, 
224L, 225L, 226L, 227L, 228L, 229L, 230L, 231L, 232L, 252L, 253L, 
254L, 255L, 256L, 257L, 258L, 259L, 260L, 261L, 281L, 282L, 283L, 
284L, 285L, 286L, 287L, 288L, 289L, 290L, 310L, 311L, 312L, 313L, 
314L, 315L, 316L, 317L, 318L, 319L, 339L, 340L, 341L, 342L, 343L, 
344L, 345L, 346L, 347L, 348L, 368L, 369L, 370L, 371L, 372L, 373L, 
374L, 375L, 376L, 377L, 397L, 398L, 399L, 400L, 401L, 402L, 403L, 
404L, 405L, 406L, 426L, 427L, 428L, 429L, 430L, 431L, 432L, 433L, 
434L, 435L, 455L, 456L, 457L, 458L, 459L, 460L, 461L, 462L, 463L, 
464L, 484L, 485L, 486L, 487L, 488L, 489L, 490L, 491L, 492L, 493L, 
513L, 514L, 515L, 516L, 517L, 518L, 519L, 520L, 521L, 522L, 542L, 
543L, 544L, 545L, 546L, 547L, 548L, 549L, 550L, 551L, 571L, 572L, 
573L, 574L, 575L, 576L, 577L, 578L, 579L, 580L, 600L, 601L, 602L, 
603L, 604L, 605L, 606L, 607L, 608L, 609L, 629L, 630L, 631L, 632L, 
633L, 634L, 635L, 636L, 637L, 638L, 658L, 659L, 660L, 661L, 662L, 
663L, 664L, 665L, 666L, 667L, 687L, 688L, 689L, 690L, 691L, 692L, 
693L, 694L, 695L, 696L, 716L, 717L, 718L, 719L, 720L, 721L, 722L, 
723L, 724L, 725L, 745L, 746L, 747L, 748L, 749L, 750L, 751L, 752L, 
753L, 754L, 774L, 775L, 776L, 777L, 778L, 779L, 780L, 781L, 782L, 
783L, 803L, 804L, 805L, 806L, 807L, 808L, 809L, 810L, 811L, 812L, 
832L, 833L, 834L, 835L, 836L, 837L, 838L, 839L, 840L, 841L, 861L, 
862L, 863L, 864L, 865L, 866L, 867L, 868L, 869L, 870L), class = "data.frame")

(注意:在此值得注意的是,在创建可复制代码之前,我已将参与者"更改为一个因子.这是为了确保aov的输出与III型ezANOVA的输出匹配.影响aov的输出,使其与summary.lm()不兼容.但是,用aov运行重复测量时似乎无法避免,请参见

Cond_Per_Row_stats$Condition <- factor (Cond_Per_Row_stats$Condition, levels = c("P0.0np1200.0", "P0.0np50.0",
                                                                     "P3np1200.0", "P3np50.0",
                                                                     "P35np1200.0", "P35np50.0",
                                                                     "P4np1200.0", "P4np50.0",
                                                                     "P45np1200.0", "P45np50.0",

                                                                     "P0.0tp1200.0", "P0.0tp50.0",
                                                                     "P3tp1200.0", "P3tp50.0",
                                                                     "P35tp1200.0", "P35tp50.0",
                                                                     "P4tp1200.0", "P4tp50.0",
                                                                     "P45tp1200.0", "P45tp50.0",

                                                                     "P0.0fp1200.0", "P0.0fp50.0",
                                                                     "P3fp1200.0", "P3fp50.0",
                                                                     "P35fp1200.0", "P35fp50.0",
                                                                     "P4fp1200.0", "P4fp50.0",
                                                                     "P45fp1200.0", "P45fp50.0"
                                                                 ))
Cond_Per_Row_stats <- Cond_Per_Row_stats[order(Cond_Per_Row_stats$Condition),]

我多次重复测量:

    aovModel <- aov(Accuracy ~ (Coherence * PrimeDuration * PrimeType) + Error(Participant/(Coherence * PrimeDuration * PrimeType)), data = Cond_Per_Row_stats)
    summary(aovModel)

具有以下输出:

Error: Participant
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9  2.045  0.2272               

Error: Participant:Coherence
          Df Sum Sq Mean Sq F value   Pr(>F)    
Coherence  4  7.800  1.9499    66.3 4.18e-16 ***
Residuals 36  1.059  0.0294                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:PrimeDuration
              Df  Sum Sq Mean Sq F value  Pr(>F)   
PrimeDuration  1 0.10509 0.10509   10.91 0.00918 **
Residuals      9 0.08668 0.00963                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:PrimeType
          Df Sum Sq Mean Sq F value Pr(>F)
PrimeType  2  0.137 0.06850   0.763  0.481
Residuals 18  1.617 0.08981               

Error: Participant:Coherence:PrimeDuration
                        Df Sum Sq Mean Sq F value Pr(>F)  
Coherence:PrimeDuration  4 0.1355 0.03387   2.443 0.0643 .
Residuals               36 0.4992 0.01387                 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:Coherence:PrimeType
                    Df Sum Sq Mean Sq F value Pr(>F)
Coherence:PrimeType  8 0.1439 0.01798   1.084  0.384
Residuals           72 1.1943 0.01659               

Error: Participant:PrimeDuration:PrimeType
                        Df Sum Sq Mean Sq F value Pr(>F)
PrimeDuration:PrimeType  2 0.0296 0.01481   0.563  0.579
Residuals               18 0.4733 0.02629               

Error: Participant:Coherence:PrimeDuration:PrimeType
                                  Df Sum Sq Mean Sq F value Pr(>F)
Coherence:PrimeDuration:PrimeType  8 0.0979 0.01223   0.884  0.534
Residuals                         72 0.9965 0.01384  

接下来,我尝试进行计划中的对比,这就是我遇到的问题.首先,我要使用:

summary.lm(aovModel)

但是重复测量模型的输出不兼容:

Error in if (p == 0) { : argument is of length zero

当我只想要模型的摘要时,这不是一个大问题,我可以使用summary(aovModel)并在那里检查SS,F值等.当我想使用summary.lm()总结计划的对比时,这是一个问题.

例如,从数据框中可以看到有30个条件.这是我整理的代码,试图创建计划的对比度,其中将10 np个条件作为控件,并在contrast1中将其余条件与它们进行比较,然后在:

contrast1<-c(-20,-20,-20,-20,-20,-20,-20,-20,-20,-20,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10)
contrast2<-c(0,0,0,0,0,0,0,0,0,0,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10,10,10,10,10,10,10)

contrasts(Cond_Per_Row_stats$Condition)<-cbind(contrast1, contrast2)

Cond_Per_Row_stats$Condition

aovModelContrastCondition <- aov(Accuracy ~ (Coherence * PrimeDuration * PrimeType) + Error(Participant/(Coherence * PrimeDuration * PrimeType)), data = Cond_Per_Row_stats)

summary.lm(aovModelContrastCondition)

summary.lm()的输出将导致与上述相同的错误.

但是,如果我运行以下代码直接调用一个部分:

summary.lm(aovModelContrastCondition$'Participant:Coherence:PrimeDuration:PrimeType')

我得到以下输出:

Residuals:
     Min       1Q   Median       3Q      Max 
-0.23063 -0.08368 -0.02695  0.06902  0.27561 

Coefficients:
                                           Estimate Std. Error t value Pr(>|t|)  
CoherenceP3:PrimeDuration50ms:PrimeTypenp   0.15288    0.10522   1.453   0.1506  
CoherenceP35:PrimeDuration50ms:PrimeTypenp  0.13600    0.10522   1.293   0.2003  
CoherenceP4:PrimeDuration50ms:PrimeTypenp   0.07323    0.10522   0.696   0.4887  
CoherenceP45:PrimeDuration50ms:PrimeTypenp  0.09476    0.10522   0.901   0.3708  
CoherenceP3:PrimeDuration50ms:PrimeTypetp   0.10329    0.10522   0.982   0.3296  
CoherenceP35:PrimeDuration50ms:PrimeTypetp  0.22469    0.10522   2.135   0.0361 *
CoherenceP4:PrimeDuration50ms:PrimeTypetp   0.17215    0.10522   1.636   0.1062  
CoherenceP45:PrimeDuration50ms:PrimeTypetp  0.10710    0.10522   1.018   0.3122  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1176 on 72 degrees of freedom
Multiple R-squared:  0.08646,   Adjusted R-squared:  -0.002361 
F-statistic: 0.9734 on 7 and 72 DF,  p-value: 0.4572

基本上,我不太确定自己在这里看到的内容(尤其是考虑如何设置contrast1contrast2).我已经看到在受试者设计之间使用了计划中的对比示例,因此在进行重复测量方差分析时无法使用summary.lm()解决问题.

在将summary.lm()用于重复测量计划的对比时,是否有人有任何经验或专业知识?还是使用aov在重复测量方差分析中查看计划对比结果的另一种方法?

谢谢.

解决方案

emmeans包可以处理aovlist对象(和

现在,我们创建一个emmGrid对象,并使用emmeans()函数查看估计的边际均值(EMM).

emm <- emmeans(aovModel, ~ Coherence * PrimeDuration * PrimeType)
emm
## Coherence PrimeDuration PrimeType    emmean         SE    df  lower.CL  upper.CL
## P0.0      1200ms        fp        0.7330383 0.05433093 91.44 0.6251235 0.8409531
## P3        1200ms        fp        0.8654093 0.05433093 91.44 0.7574945 0.9733241
## P35       1200ms        fp        0.9813125 0.05433093 91.44 0.8733977 1.0892273
## P4        1200ms        fp        1.1298314 0.05433093 91.44 1.0219167 1.2377462
## P45       1200ms        fp        1.2569780 0.05433093 91.44 1.1490632 1.3648928
## P0.0      50ms          fp        0.8324380 0.05433093 91.44 0.7245232 0.9403528
## P3        50ms          fp        0.8061391 0.05433093 91.44 0.6982243 0.9140539
## P35       50ms          fp        0.8619138 0.05433093 91.44 0.7539990 0.9698286
## P4        50ms          fp        1.0194414 0.05433093 91.44 0.9115266 1.1273562
## P45       50ms          fp        1.2212040 0.05433093 91.44 1.1132892 1.3291188
## P0.0      1200ms        np        0.7514145 0.05433093 91.44 0.6434997 0.8593293
## P3        1200ms        np        0.8640397 0.05433093 91.44 0.7561249 0.9719545
## P35       1200ms        np        1.0230695 0.05433093 91.44 0.9151547 1.1309843
## P4        1200ms        np        1.1691818 0.05433093 91.44 1.0612670 1.2770966
## P45       1200ms        np        1.1809446 0.05433093 91.44 1.0730298 1.2888594
## P0.0      50ms          np        0.7943392 0.05433093 91.44 0.6864244 0.9022540
## P3        50ms          np        0.9011751 0.05433093 91.44 0.7932603 1.0090898
## P35       50ms          np        0.9831985 0.05433093 91.44 0.8752838 1.0911133
## P4        50ms          np        1.0755496 0.05433093 91.44 0.9676348 1.1834644
## P45       50ms          np        1.1834531 0.05433093 91.44 1.0755383 1.2913679
## P0.0      1200ms        tp        0.8285699 0.05433093 91.44 0.7206552 0.9364847
## P3        1200ms        tp        0.9410529 0.05433093 91.44 0.8331381 1.0489676
## P35       1200ms        tp        0.9957669 0.05433093 91.44 0.8878521 1.1036817
## P4        1200ms        tp        1.1742093 0.05433093 91.44 1.0662945 1.2821241
## P45       1200ms        tp        1.3174114 0.05433093 91.44 1.2094966 1.4253262
## P0.0      50ms          tp        0.7945863 0.05433093 91.44 0.6866715 0.9025010
## P3        50ms          tp        0.8516896 0.05433093 91.44 0.7437749 0.9596044
## P35       50ms          tp        0.9676721 0.05433093 91.44 0.8597573 1.0755868
## P4        50ms          tp        1.1025843 0.05433093 91.44 0.9946695 1.2104990
## P45       50ms          tp        1.2553532 0.05433093 91.44 1.1474384 1.3632680

您的对比等同于以下假设:

考虑所有因子水平及其在emmGrid对象中的顺序,我们可以将这些假设等效表达为:

由此我们可以看到contrast1contrast2所需的对比度权重:

contrast1 <- rep(c(-0.5, 1, -0.5) / 10, each = 10)
contrast2 <- rep(c(-1, 0, 1) / 10, each = 10) 

我们现在可以使用contrast()函数来计算您的自定义对比度并获得 p 值.

contrast(emm, list(c1 = contrast1, 
                   c2 = contrast2))
## contrast     estimate         SE df t.ratio p.value
## c1       -0.004193526 0.03670287 18  -0.114  0.9103
## c2        0.052118996 0.04238082 18   1.230  0.2346


如果您仅对与因子PrimeType有关的对比感兴趣,则按如下所示构造emmGrid对象甚至更容易:

emm <- emmeans(aovModel, ~ PrimeType)

这在CoherencePrimeDuration的水平上进行了隐式平均(这也由输出指示).

emm
## PrimeType    emmean         SE    df  lower.CL upper.CL
## fp        0.9707706 0.03682466 21.98 0.8943978 1.047143
## np        0.9926366 0.03682466 21.98 0.9162638 1.069009
## tp        1.0228896 0.03682466 21.98 0.9465168 1.099262
##
## Results are averaged over the levels of: Coherence, PrimeDuration 

然后我们可以通过以下方式指定contrast1contrast2的对比度权重:

contrast1 <- c(-0.5, 1, -0.5)
contrast2 <- c(-1, 0, 1)

结果等于我们使用更复杂"方法获得的结果.

Related Bounty: 250 reputation points.

I have a question regarding summary.lm() output.

Firstly, here is reproducible code for my data set:

Cond_Per_Row_stats<-structure(list(Participant = structure(c(1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L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, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1200ms", 
    "50ms"), class = "factor"), Condition = structure(c(21L, 
    21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L, 
    22L, 22L, 22L, 22L, 22L, 22L, 22L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 11L, 
    11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 
    12L, 12L, 12L, 12L, 12L, 12L, 12L, 25L, 25L, 25L, 25L, 25L, 
    25L, 25L, 25L, 25L, 25L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 
    26L, 26L, 26L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 15L, 15L, 15L, 15L, 15L, 
    15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 
    16L, 16L, 16L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 
    23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 
    4L, 4L, 4L, 4L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 
    13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 29L, 
    29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 
    30L, 30L, 30L, 30L, 30L, 30L, 30L, 9L, 9L, 9L, 9L, 9L, 9L, 
    9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
    10L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 
    20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 27L, 27L, 27L, 
    27L, 27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 
    28L, 28L, 28L, 28L, 28L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
    7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 17L, 17L, 
    17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 
    18L, 18L, 18L, 18L, 18L, 18L), .Label = c("P0.0np1200.0", 
    "P0.0np50.0", "P3np1200.0", "P3np50.0", "P35np1200.0", "P35np50.0", 
    "P4np1200.0", "P4np50.0", "P45np1200.0", "P45np50.0", "P0.0tp1200.0", 
    "P0.0tp50.0", "P3tp1200.0", "P3tp50.0", "P35tp1200.0", "P35tp50.0", 
    "P4tp1200.0", "P4tp50.0", "P45tp1200.0", "P45tp50.0", "P0.0fp1200.0", 
    "P0.0fp50.0", "P3fp1200.0", "P3fp50.0", "P35fp1200.0", "P35fp50.0", 
    "P4fp1200.0", "P4fp50.0", "P45fp1200.0", "P45fp50.0"), class = "factor"), 
    Accuracy = c(0.785398163397448, 0.523598775598299, 0.785398163397448, 
    0.523598775598299, 0.785398163397448, 0.869122203007293, 
    0.955316618124509, 0.785398163397448, 0.615479708670387, 
    0.701674123787604, 1.15026199151093, 1.15026199151093, 0.869122203007293, 
    0.523598775598299, 0.701674123787604, 0.701674123787604, 
    0.955316618124509, 0.701674123787604, 0.955316618124509, 
    0.615479708670387, 0.955316618124509, 0.785398163397448, 
    0.701674123787604, 0.869122203007293, 0.785398163397448, 
    0.615479708670387, 0.615479708670387, 0.869122203007293, 
    0.701674123787604, 0.615479708670387, 1.0471975511966, 0.869122203007293, 
    0.615479708670387, 0.615479708670387, 0.869122203007293, 
    0.701674123787604, 0.701674123787604, 0.869122203007293, 
    0.785398163397448, 0.869122203007293, 1.0471975511966, 0.955316618124509, 
    0.523598775598299, 1.0471975511966, 0.615479708670387, 0.955316618124509, 
    0.615479708670387, 0.785398163397448, 0.955316618124509, 
    0.785398163397448, 0.701674123787604, 0.615479708670387, 
    0.615479708670387, 0.955316618124509, 0.869122203007293, 
    0.869122203007293, 1.0471975511966, 0.785398163397448, 0.701674123787604, 
    0.785398163397448, 1.0471975511966, 0.911738290968488, 1.00028587904971, 
    0.827113206702756, 0.785398163397448, 1.00028587904971, 1.09681145610345, 
    1.00028587904971, 1.0471975511966, 1.09681145610345, 1.0471975511966, 
    0.827113206702756, 1.0471975511966, 0.420534335283965, 0.659058035826409, 
    1.0471975511966, 0.869122203007293, 1.0471975511966, 0.869122203007293, 
    0.785398163397448, 1.09681145610345, 0.785398163397448, 0.955316618124509, 
    0.911738290968488, 0.911738290968488, 1.00028587904971, 1.20942920288819, 
    1.15026199151093, 1.00028587904971, 1.20942920288819, 1.09681145610345, 
    1.0471975511966, 0.911738290968488, 0.827113206702756, 1.00028587904971, 
    0.969532110115768, 1.09681145610345, 1.00028587904971, 0.785398163397448, 
    1.09681145610345, 1.09681145610345, 0.869122203007293, 0.743683120092141, 
    0.869122203007293, 0.869122203007293, 1.0471975511966, 1.00028587904971, 
    1.09681145610345, 1.36522739563372, 1.00028587904971, 1.15026199151093, 
    0.869122203007293, 0.570510447745185, 1.20942920288819, 1.0471975511966, 
    0.955316618124509, 0.827113206702756, 1.00028587904971, 1.00028587904971, 
    1.0471975511966, 0.955316618124509, 0.911738290968488, 0.911738290968488, 
    0.570510447745185, 0.869122203007293, 1.00028587904971, 0.869122203007293, 
    0.785398163397448, 0.911738290968488, 0.869122203007293, 
    0.785398163397448, 0.701674123787604, 1.00028587904971, 0.420534335283965, 
    0.570510447745185, 0.969532110115768, 0.869122203007293, 
    0.911738290968488, 1.0471975511966, 0.785398163397448, 0.955316618124509, 
    0.827113206702756, 0.827113206702756, 0.659058035826409, 
    0.955316618124509, 0.701674123787604, 0.785398163397448, 
    0.785398163397448, 1.09681145610345, 1.0471975511966, 0.869122203007293, 
    0.827113206702756, 0.911738290968488, 0.827113206702756, 
    0.785398163397448, 0.827113206702756, 1.00028587904971, 0.911738290968488, 
    1.09681145610345, 0.955316618124509, 0.955316618124509, 1.15026199151093, 
    0.785398163397448, 0.955316618124509, 0.911738290968488, 
    1.0471975511966, 0.869122203007293, 0.869122203007293, 0.911738290968488, 
    0.955316618124509, 0.955316618124509, 0.827113206702756, 
    0.785398163397448, 0.869122203007293, 0.955316618124509, 
    0.684719203002283, 0.827113206702756, 1.00028587904971, 0.785398163397448, 
    0.827113206702756, 1.27795355506632, 1.20942920288819, 1.27795355506632, 
    1.00028587904971, 0.869122203007293, 1.15026199151093, 1.36522739563372, 
    1.27795355506632, 1.5707963267949, 1.5707963267949, 1.5707963267949, 
    1.27795355506632, 1.20942920288819, 0.911738290968488, 0.659058035826409, 
    1.36522739563372, 1.20942920288819, 1.36522739563372, 1.36522739563372, 
    1.27795355506632, 1.20942920288819, 1.0471975511966, 1.15026199151093, 
    1.15026199151093, 0.869122203007293, 1.27795355506632, 1.36522739563372, 
    1.27795355506632, 1.09681145610345, 1.36522739563372, 1.27795355506632, 
    1.00028587904971, 1.27795355506632, 1.15026199151093, 1.00028587904971, 
    1.36522739563372, 1.09681145610345, 1.15026199151093, 1.15026199151093, 
    1.36522739563372, 1.5707963267949, 1.5707963267949, 0.869122203007293, 
    1.09681145610345, 1.20942920288819, 1.36522739563372, 1.27795355506632, 
    1.27795355506632, 1.36522739563372, 1.5707963267949, 1.5707963267949, 
    1.15026199151093, 0.911738290968488, 1.20942920288819, 1.20942920288819, 
    1.28403977458335, 1.20942920288819, 1.36522739563372, 1.27795355506632, 
    1.36522739563372, 1.20942920288819, 0.911738290968488, 1.20942920288819, 
    1.0471975511966, 0.827113206702756, 1.5707963267949, 1.0471975511966, 
    1.0471975511966, 1.15026199151093, 1.27795355506632, 1.15026199151093, 
    1.00028587904971, 1.20942920288819, 0.659058035826409, 0.785398163397448, 
    1.09681145610345, 1.20942920288819, 0.827113206702756, 1.0471975511966, 
    1.20942920288819, 1.5707963267949, 0.955316618124509, 1.0471975511966, 
    1.0471975511966, 0.869122203007293, 1.20942920288819, 1.27795355506632, 
    1.09681145610345, 1.0471975511966, 1.5707963267949, 1.27795355506632, 
    0.869122203007293, 1.00028587904971, 0.911738290968488, 0.911738290968488, 
    1.00028587904971, 1.20942920288819, 1.20942920288819, 1.00028587904971, 
    1.36522739563372, 1.0471975511966, 1.09681145610345, 0.827113206702756, 
    1.15026199151093, 1.09681145610345, 1.27795355506632, 1.36522739563372, 
    1.36522739563372, 1.36522739563372, 1.15026199151093, 1.27795355506632, 
    0.955316618124509, 0.701674123787604, 1.09681145610345, 1.00028587904971, 
    1.20942920288819, 1.20942920288819, 1.20942920288819, 1.00028587904971, 
    1.36522739563372)), .Names = c("Participant", "Coherence", 
"PrimeType", "PrimeDuration", "Condition", "Accuracy"), row.names = c(20L, 
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 49L, 50L, 51L, 52L, 
53L, 54L, 55L, 56L, 57L, 58L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 
85L, 86L, 87L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 
115L, 116L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L, 
145L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L, 
194L, 195L, 196L, 197L, 198L, 199L, 200L, 201L, 202L, 203L, 223L, 
224L, 225L, 226L, 227L, 228L, 229L, 230L, 231L, 232L, 252L, 253L, 
254L, 255L, 256L, 257L, 258L, 259L, 260L, 261L, 281L, 282L, 283L, 
284L, 285L, 286L, 287L, 288L, 289L, 290L, 310L, 311L, 312L, 313L, 
314L, 315L, 316L, 317L, 318L, 319L, 339L, 340L, 341L, 342L, 343L, 
344L, 345L, 346L, 347L, 348L, 368L, 369L, 370L, 371L, 372L, 373L, 
374L, 375L, 376L, 377L, 397L, 398L, 399L, 400L, 401L, 402L, 403L, 
404L, 405L, 406L, 426L, 427L, 428L, 429L, 430L, 431L, 432L, 433L, 
434L, 435L, 455L, 456L, 457L, 458L, 459L, 460L, 461L, 462L, 463L, 
464L, 484L, 485L, 486L, 487L, 488L, 489L, 490L, 491L, 492L, 493L, 
513L, 514L, 515L, 516L, 517L, 518L, 519L, 520L, 521L, 522L, 542L, 
543L, 544L, 545L, 546L, 547L, 548L, 549L, 550L, 551L, 571L, 572L, 
573L, 574L, 575L, 576L, 577L, 578L, 579L, 580L, 600L, 601L, 602L, 
603L, 604L, 605L, 606L, 607L, 608L, 609L, 629L, 630L, 631L, 632L, 
633L, 634L, 635L, 636L, 637L, 638L, 658L, 659L, 660L, 661L, 662L, 
663L, 664L, 665L, 666L, 667L, 687L, 688L, 689L, 690L, 691L, 692L, 
693L, 694L, 695L, 696L, 716L, 717L, 718L, 719L, 720L, 721L, 722L, 
723L, 724L, 725L, 745L, 746L, 747L, 748L, 749L, 750L, 751L, 752L, 
753L, 754L, 774L, 775L, 776L, 777L, 778L, 779L, 780L, 781L, 782L, 
783L, 803L, 804L, 805L, 806L, 807L, 808L, 809L, 810L, 811L, 812L, 
832L, 833L, 834L, 835L, 836L, 837L, 838L, 839L, 840L, 841L, 861L, 
862L, 863L, 864L, 865L, 866L, 867L, 868L, 869L, 870L), class = "data.frame")

(NB: It is worth noting here that I changed 'Participant' to a factor prior to creating reproducible code. This is in order to ensure the output of aov matches that of a Type III ezANOVA. This does affect the output of aov making it incompatible with summary.lm(). However, this is not avoidable it seems when running a repeated measures with aov. See here for some context.)

I then change the factor levels in Condition like this:

Cond_Per_Row_stats$Condition <- factor (Cond_Per_Row_stats$Condition, levels = c("P0.0np1200.0", "P0.0np50.0",
                                                                     "P3np1200.0", "P3np50.0",
                                                                     "P35np1200.0", "P35np50.0",
                                                                     "P4np1200.0", "P4np50.0",
                                                                     "P45np1200.0", "P45np50.0",

                                                                     "P0.0tp1200.0", "P0.0tp50.0",
                                                                     "P3tp1200.0", "P3tp50.0",
                                                                     "P35tp1200.0", "P35tp50.0",
                                                                     "P4tp1200.0", "P4tp50.0",
                                                                     "P45tp1200.0", "P45tp50.0",

                                                                     "P0.0fp1200.0", "P0.0fp50.0",
                                                                     "P3fp1200.0", "P3fp50.0",
                                                                     "P35fp1200.0", "P35fp50.0",
                                                                     "P4fp1200.0", "P4fp50.0",
                                                                     "P45fp1200.0", "P45fp50.0"
                                                                 ))
Cond_Per_Row_stats <- Cond_Per_Row_stats[order(Cond_Per_Row_stats$Condition),]

I run a repeated measures aov:

    aovModel <- aov(Accuracy ~ (Coherence * PrimeDuration * PrimeType) + Error(Participant/(Coherence * PrimeDuration * PrimeType)), data = Cond_Per_Row_stats)
    summary(aovModel)

With this output:

Error: Participant
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9  2.045  0.2272               

Error: Participant:Coherence
          Df Sum Sq Mean Sq F value   Pr(>F)    
Coherence  4  7.800  1.9499    66.3 4.18e-16 ***
Residuals 36  1.059  0.0294                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:PrimeDuration
              Df  Sum Sq Mean Sq F value  Pr(>F)   
PrimeDuration  1 0.10509 0.10509   10.91 0.00918 **
Residuals      9 0.08668 0.00963                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:PrimeType
          Df Sum Sq Mean Sq F value Pr(>F)
PrimeType  2  0.137 0.06850   0.763  0.481
Residuals 18  1.617 0.08981               

Error: Participant:Coherence:PrimeDuration
                        Df Sum Sq Mean Sq F value Pr(>F)  
Coherence:PrimeDuration  4 0.1355 0.03387   2.443 0.0643 .
Residuals               36 0.4992 0.01387                 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Participant:Coherence:PrimeType
                    Df Sum Sq Mean Sq F value Pr(>F)
Coherence:PrimeType  8 0.1439 0.01798   1.084  0.384
Residuals           72 1.1943 0.01659               

Error: Participant:PrimeDuration:PrimeType
                        Df Sum Sq Mean Sq F value Pr(>F)
PrimeDuration:PrimeType  2 0.0296 0.01481   0.563  0.579
Residuals               18 0.4733 0.02629               

Error: Participant:Coherence:PrimeDuration:PrimeType
                                  Df Sum Sq Mean Sq F value Pr(>F)
Coherence:PrimeDuration:PrimeType  8 0.0979 0.01223   0.884  0.534
Residuals                         72 0.9965 0.01384  

Next I attempt to conduct planned contrasts and that's where I run into problems. First of all I want to use:

summary.lm(aovModel)

But the output from the repeated measures model is not compatible:

Error in if (p == 0) { : argument is of length zero

This isn't a massive issue when I simply want a summary of the model, I can just use summary(aovModel) and inspect the SS, F-values etc there. It is a problem when I want to summarize planned contrasts using summary.lm().

For example, as you can see from the dataframe there are 30 conditions. This is the code I've put together in an attempt to create planned contrasts where the 10 np Conditions are controls and the remaining Conditions are compared to them in contrast1 and then I compare the tp and fp Conditions against each other in contrast2:

contrast1<-c(-20,-20,-20,-20,-20,-20,-20,-20,-20,-20,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10)
contrast2<-c(0,0,0,0,0,0,0,0,0,0,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,10,10,10,10,10,10,10,10,10,10)

contrasts(Cond_Per_Row_stats$Condition)<-cbind(contrast1, contrast2)

Cond_Per_Row_stats$Condition

aovModelContrastCondition <- aov(Accuracy ~ (Coherence * PrimeDuration * PrimeType) + Error(Participant/(Coherence * PrimeDuration * PrimeType)), data = Cond_Per_Row_stats)

summary.lm(aovModelContrastCondition)

The output for summary.lm() here results in the same error as above.

However, if I run the following code calling a section directly:

summary.lm(aovModelContrastCondition$'Participant:Coherence:PrimeDuration:PrimeType')

I get this output:

Residuals:
     Min       1Q   Median       3Q      Max 
-0.23063 -0.08368 -0.02695  0.06902  0.27561 

Coefficients:
                                           Estimate Std. Error t value Pr(>|t|)  
CoherenceP3:PrimeDuration50ms:PrimeTypenp   0.15288    0.10522   1.453   0.1506  
CoherenceP35:PrimeDuration50ms:PrimeTypenp  0.13600    0.10522   1.293   0.2003  
CoherenceP4:PrimeDuration50ms:PrimeTypenp   0.07323    0.10522   0.696   0.4887  
CoherenceP45:PrimeDuration50ms:PrimeTypenp  0.09476    0.10522   0.901   0.3708  
CoherenceP3:PrimeDuration50ms:PrimeTypetp   0.10329    0.10522   0.982   0.3296  
CoherenceP35:PrimeDuration50ms:PrimeTypetp  0.22469    0.10522   2.135   0.0361 *
CoherenceP4:PrimeDuration50ms:PrimeTypetp   0.17215    0.10522   1.636   0.1062  
CoherenceP45:PrimeDuration50ms:PrimeTypetp  0.10710    0.10522   1.018   0.3122  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1176 on 72 degrees of freedom
Multiple R-squared:  0.08646,   Adjusted R-squared:  -0.002361 
F-statistic: 0.9734 on 7 and 72 DF,  p-value: 0.4572

Essentially I'm not entirely sure what I'm seeing here (especially considering how I set up contrast1 and contrast2). Examples of planned contrasts I've seen used between subjects designs and therefore do not address the issue with summary.lm() when conducting a repeated measures ANOVA.

Does anyone have any experience or know-how when it comes to adapting summary.lm() for repeated measures planned contrasts? Or is there another way of viewing the outcome of the planned contrasts in a repeated measures ANOVA using aov?

Thanks in advance.

解决方案

The emmeans package can handle aovlist objects (and many others) and calculate your custom contrasts.

At first we fit the repeated measures ANOVA using orthogonal contrasts.

library("emmeans")
# set orthogonal contrasts
options(contrasts = c("contr.sum", "contr.poly"))

aovModel <- aov(Accuracy ~ Coherence * PrimeDuration * PrimeType + 
                           Error(Participant / (Coherence * PrimeDuration * PrimeType)), 
                data = Cond_Per_Row_stats)

Now we create an emmGrid object and have a look at the estimated marginal means (EMMs) using the emmeans() function.

emm <- emmeans(aovModel, ~ Coherence * PrimeDuration * PrimeType)
emm
## Coherence PrimeDuration PrimeType    emmean         SE    df  lower.CL  upper.CL
## P0.0      1200ms        fp        0.7330383 0.05433093 91.44 0.6251235 0.8409531
## P3        1200ms        fp        0.8654093 0.05433093 91.44 0.7574945 0.9733241
## P35       1200ms        fp        0.9813125 0.05433093 91.44 0.8733977 1.0892273
## P4        1200ms        fp        1.1298314 0.05433093 91.44 1.0219167 1.2377462
## P45       1200ms        fp        1.2569780 0.05433093 91.44 1.1490632 1.3648928
## P0.0      50ms          fp        0.8324380 0.05433093 91.44 0.7245232 0.9403528
## P3        50ms          fp        0.8061391 0.05433093 91.44 0.6982243 0.9140539
## P35       50ms          fp        0.8619138 0.05433093 91.44 0.7539990 0.9698286
## P4        50ms          fp        1.0194414 0.05433093 91.44 0.9115266 1.1273562
## P45       50ms          fp        1.2212040 0.05433093 91.44 1.1132892 1.3291188
## P0.0      1200ms        np        0.7514145 0.05433093 91.44 0.6434997 0.8593293
## P3        1200ms        np        0.8640397 0.05433093 91.44 0.7561249 0.9719545
## P35       1200ms        np        1.0230695 0.05433093 91.44 0.9151547 1.1309843
## P4        1200ms        np        1.1691818 0.05433093 91.44 1.0612670 1.2770966
## P45       1200ms        np        1.1809446 0.05433093 91.44 1.0730298 1.2888594
## P0.0      50ms          np        0.7943392 0.05433093 91.44 0.6864244 0.9022540
## P3        50ms          np        0.9011751 0.05433093 91.44 0.7932603 1.0090898
## P35       50ms          np        0.9831985 0.05433093 91.44 0.8752838 1.0911133
## P4        50ms          np        1.0755496 0.05433093 91.44 0.9676348 1.1834644
## P45       50ms          np        1.1834531 0.05433093 91.44 1.0755383 1.2913679
## P0.0      1200ms        tp        0.8285699 0.05433093 91.44 0.7206552 0.9364847
## P3        1200ms        tp        0.9410529 0.05433093 91.44 0.8331381 1.0489676
## P35       1200ms        tp        0.9957669 0.05433093 91.44 0.8878521 1.1036817
## P4        1200ms        tp        1.1742093 0.05433093 91.44 1.0662945 1.2821241
## P45       1200ms        tp        1.3174114 0.05433093 91.44 1.2094966 1.4253262
## P0.0      50ms          tp        0.7945863 0.05433093 91.44 0.6866715 0.9025010
## P3        50ms          tp        0.8516896 0.05433093 91.44 0.7437749 0.9596044
## P35       50ms          tp        0.9676721 0.05433093 91.44 0.8597573 1.0755868
## P4        50ms          tp        1.1025843 0.05433093 91.44 0.9946695 1.2104990
## P45       50ms          tp        1.2553532 0.05433093 91.44 1.1474384 1.3632680

Your contrasts equate to the following hypotheses:

Considering all factor levels and their order in the emmGrid object, we can express these hypotheses equivalently as:

From this we can see the contrast weights you need for contrast1 and contrast2:

contrast1 <- rep(c(-0.5, 1, -0.5) / 10, each = 10)
contrast2 <- rep(c(-1, 0, 1) / 10, each = 10) 

To calculate your custom contrasts and get p-values we can now use the contrast() function.

contrast(emm, list(c1 = contrast1, 
                   c2 = contrast2))
## contrast     estimate         SE df t.ratio p.value
## c1       -0.004193526 0.03670287 18  -0.114  0.9103
## c2        0.052118996 0.04238082 18   1.230  0.2346


If you are only interested in contrasts related to the factor PrimeType it is even easier to construct the emmGrid object as follows:

emm <- emmeans(aovModel, ~ PrimeType)

This implicitly averages over the levels of Coherence and PrimeDuration (which is also indicated by the output).

emm
## PrimeType    emmean         SE    df  lower.CL upper.CL
## fp        0.9707706 0.03682466 21.98 0.8943978 1.047143
## np        0.9926366 0.03682466 21.98 0.9162638 1.069009
## tp        1.0228896 0.03682466 21.98 0.9465168 1.099262
##
## Results are averaged over the levels of: Coherence, PrimeDuration 

We can then specify the contrast weights for contrast1 and contrast2 by:

contrast1 <- c(-0.5, 1, -0.5)
contrast2 <- c(-1, 0, 1)

The results are equal to the ones we obtained with the "more complex" method.

这篇关于在R中使用aov时的summary.lm输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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