Split-plot-factorial ANOVA (SPF-p.q design)

TODO

  • link to anovaSPFpqr, anovaMixed, dfReshape

Traditional univariate analysis and multivariate approach.

Install required packages

car, effectsize, multcomp

Two-way SPF-\(p \cdot q\) ANOVA

Using aov() with data in long format


Error: id
          Df Sum Sq Mean Sq F value   Pr(>F)    
IVbtw      2  178.4   89.21   14.92 4.33e-05 ***
Residuals 27  161.5    5.98                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: id:IVwth
            Df Sum Sq Mean Sq F value   Pr(>F)    
IVwth        2  131.0   65.50   8.446 0.000643 ***
IVbtw:IVwth  4   43.4   10.85   1.399 0.246589    
Residuals   54  418.8    7.75                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Using Anova() from package car with data in wide format


Univariate Type II Repeated-Measures ANOVA Assuming Sphericity

             Sum Sq num Df Error SS den Df F value    Pr(>F)    
(Intercept)  60.859      1   161.46     27 10.1769 0.0035871 ** 
IVbtw       178.416      2   161.46     27 14.9174 4.326e-05 ***
IVwth       130.999      2   418.76     54  8.4464 0.0006433 ***
IVbtw:IVwth  43.407      4   418.76     54  1.3994 0.2465888    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Mauchly Tests for Sphericity

            Test statistic p-value
IVwth              0.98096 0.77892
IVbtw:IVwth        0.98096 0.77892


Greenhouse-Geisser and Huynh-Feldt Corrections
 for Departure from Sphericity

             GG eps Pr(>F[GG])    
IVwth       0.98132  0.0007035 ***
IVbtw:IVwth 0.98132  0.2473928    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

              HF eps   Pr(>F[HF])
IVwth       1.057498 0.0006432656
IVbtw:IVwth 1.057498 0.2465887981

Using anova.mlm() and mauchly.test() with data in wide format

Analysis of Variance Table


Contrasts orthogonal to
~0


Contrasts spanned by
~1

Greenhouse-Geisser epsilon: 1
Huynh-Feldt epsilon:        1

            Df      F num Df den Df    Pr(>F)    G-G Pr    H-F Pr
(Intercept)  1 10.177      1     27 0.0035871 0.0035871 0.0035871
IVbtw        2 14.917      2     27 0.0000433 0.0000433 0.0000433
Residuals   27                                                   
Analysis of Variance Table


Contrasts orthogonal to
~1


Contrasts spanned by
~IVwth

Greenhouse-Geisser epsilon: 0.9813
Huynh-Feldt epsilon:        1.0575

            Df      F num Df den Df   Pr(>F)   G-G Pr   H-F Pr
(Intercept)  1 8.4464      2     54 0.000643 0.000703 0.000643
IVbtw        2 1.3994      4     54 0.246589 0.247393 0.246589
Residuals   27                                                

    Mauchly's test of sphericity
    Contrasts orthogonal to
    ~1

    Contrasts spanned by
    ~IVwth


data:  SSD matrix from lm(formula = cbind(DV.1, DV.2, DV.3) ~ IVbtw, data = dfSPFpqW)
W = 0.98096, p-value = 0.7789

Effect size estimates: generalized \(\hat{\eta}_{g}^{2}\)

Group    |   Parameter | Eta2 |       90% CI
--------------------------------------------
id       |       IVbtw | 0.19 | [0.00, 0.38]
id:IVwth |       IVwth | 0.14 | [0.02, 0.28]
id:IVwth | IVbtw:IVwth | 0.05 | [0.00, 0.10]
Group    |   Parameter | Eta2 (partial) |       90% CI
------------------------------------------------------
id       |       IVbtw |           0.52 | [0.28, 0.67]
id:IVwth |       IVwth |           0.24 | [0.08, 0.38]
id:IVwth | IVbtw:IVwth |           0.09 | [0.00, 0.19]
Group    |   Parameter | Eta2 (generalized) |       90% CI
----------------------------------------------------------
id       |       IVbtw |               0.24 | [0.02, 0.43]
id:IVwth |       IVwth |               0.18 | [0.04, 0.32]
id:IVwth | IVbtw:IVwth |               0.07 | [0.00, 0.15]

Simple effects

Separate error terms

Between-subjects effect at a fixed level of the within-subjects factor

            Df Sum Sq Mean Sq F value Pr(>F)  
IVbtw        2  81.81   40.90   4.694 0.0178 *
Residuals   27 235.26    8.71                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
            Df Sum Sq Mean Sq F value Pr(>F)  
IVbtw        2  37.15  18.577   2.814 0.0776 .
Residuals   27 178.24   6.601                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
            Df Sum Sq Mean Sq F value  Pr(>F)   
IVbtw        2  102.9   51.43   8.329 0.00152 **
Residuals   27  166.7    6.17                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Within-subjects effect at a fixed level of the between-subjects factor


Error: id
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9   22.6   2.511               

Error: id:IVwth
          Df Sum Sq Mean Sq F value Pr(>F)  
IVwth      2  46.99   23.49   3.512 0.0516 .
Residuals 18 120.41    6.69                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: id
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9  23.14   2.571               

Error: id:IVwth
          Df Sum Sq Mean Sq F value  Pr(>F)   
IVwth      2  111.4   55.71   8.153 0.00301 **
Residuals 18  123.0    6.83                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: id
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  9  115.7   12.86               

Error: id:IVwth
          Df Sum Sq Mean Sq F value Pr(>F)
IVwth      2   16.0   7.998   0.821  0.456
Residuals 18  175.3   9.742               

Planned comparisons for the between-subjects factor


     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: User-defined Contrasts


Fit: aov(formula = DV ~ IVbtw, data = mDf)

Linear Hypotheses:
                  Estimate Std. Error t value Pr(>t)
-0.5*(A+B)+C <= 0  -2.3750     0.5468  -4.343      1
A-C <= 0           -3.4206     0.6314  -5.418      1
(Adjusted p values reported -- none method)

Detach (automatically) loaded packages (if possible)

Get the article source from GitHub

R markdown - markdown - R code - all posts