24 oct 2018

One-way repeated

The one-way repeated measures ANOVA analyses the variance of the model while reducing the error by the within person variance.

- 1 dependent/outcome variable
- 1 independent/predictor variable
- 2 or more levels

- All with same subjects

- Uni- or Multivariate
- Continuous dependent variable
- Normaly distributed
- Shapiro-Wilk

- Equality of variance within groups
- Mauchly's test of Sphericity

- Field: 14.2.3 p 546, Output 14.2 p 560
- Field: Output 14.4 p 562
- Field: Jane Superbrain 14.2 p 548, Output 14.2 p 560. GG and HF.
- Field: Jane Superbrain 14.2 p 548. Sample size \(n\) is larger than \(a\) (number of levels) + 10
- Field: 14.2.5 p 548, Output 14.2 p 560
- Field: 14.2.5 p 548, Output 14.4 p 562
- Field: 14.2.5 p 548, Output 14.4 p 562

Variance | Sum of Squares | df | Mean Squares | F-ratio |
---|---|---|---|---|

Between | \({SS}_{{between}} = {SS}_{{total}} - {SS}_{{within}}\) | \({DF}_{{total}}-{DF}_{{within}}\) | \(\frac{{SS}_{{between}}}{{DF}_{{between}}}\) | Â |

Within | \({SS}_{{within}} = \sum{s_i^2(n_i-1)}\) | \((n_i-1)n\) | \(\frac{{SS}_{{within}}}{{DF}_{{within}}}\) | Â |

â€¢ Model | \({SS}_{{model}} = \sum{n_k(\bar{X}_k-\bar{X})^2}\) | \(k-1\) | \(\frac{{SS}_{{model}}}{{DF}_{{model}}}\) | \(\frac{{MS}_{{model}}}{{MS}_{{error}}}\) |

â€¢ Error | \({SS}_{{error}} = {SS}_{{within}} - {SS}_{{model}}\) | \((n-1)(k-1)\) | \(\frac{{SS}_{{error}}}{{DF}_{{error}}}\) | Â |

Total | \({SS}_{{total}} = s_{grand}^2(N-1)\) | \(N-1\) | \(\frac{{SS}_{{total}}}{{DF}_{{total}}}\) | Â |

Where \(n_i\) is the number of observations per person and \(k\) is the number of conditions. These two are equal for a one-way repeated ANOVA. Furthermore \(n\) is the number of subjects per condition and \(N\) is the total number of data points \(n \times k\).

Measure driving ability in a driving simulator. Test in three consecutive conditions where participants come back to attend the next condition.

- Alcohol none
- Alcohol some
- Alcohol much

# Assign to individual variables none_alc = data$none_alc some_alc = data$some_alc much_alc = data$much_alc total = c(none_alc,some_alc,much_alc)

\[{MS}_{total} = \frac{{SS}_{{total}}}{{DF}_{{total}}} = s_{grand}^2\]

MS_total = var(total); MS_total

## [1] 0.9410458

\[{DF_{total}} = N-1 \\ {SS}_{{total}} = s_{grand}^2(N-1)\]

N = length(total) DF_total = N - 1 SS_total = MS_total * DF_total; SS_total

## [1] 55.5217

sum((total - mean(total))^2)

## [1] 55.5217

# Set offset offset = .2 # Calculate n n = length(none_alc) # Create plot plot(none_alc, xlab = 'participants', ylab = 'Brokken', xlim = c(.5,22), ylim = c(3,7.5), col='green') points((1:n)-offset, some_alc, col='red') points((1:n)+offset, much_alc, col='blue') # Add the total mean lines(c((1-offset),(n+offset)),rep(mean(total),2),col='black',lwd=2) segments(1:n, mean(total), 1:n, none_alc) segments(1:n-offset, mean(total), 1:n-offset, some_alc) segments(1:n+offset, mean(total), 1:n+offset, much_alc) text(n+offset,mean(total),expression(bar(X)[grand]),pos=4)