5.10 McNemar’s Test

This test applies when you have paired samples.

Wilcoxon Paired-Sample applies when the variable distributions are non-normally distributed and samples are paired.

5.10.1 MANOVA

Multi-factor ANOVA (MANOVA) is a method to compare mean responses by treatment factor level of two or more treatments applied in combination. The null hypotheses are \(H_0: \mu_{1.} = \mu_{2.} = \dots = \mu_{a.}\) for the \(a\) levels of factor 1, \(H_0: \mu_{.1} = \mu_{.2} = \dots = \mu_{.b}\) for the \(b\) levels of factor 2, etc. for all the factors in the experiment, and $H_0: $ no interaction for all the factor interactions.

There are two equivalent ways to state the MANOVA model:

\[Y_{ijk} = \mu_{ij} + \epsilon_{ijk}\]

In this notation \(Y_{ijk}\) refers to the \(k^{th}\) observation in the \(j^{th}\) level of factor two and the \(i^{th}\) level of factor 1. Potentially there could be additional factors. This model formulation decomposes the response into a cell mean and an error term. The second makes the factor effect more explicit and is thus more common:

\[Y_{ijk} = \mu + \alpha_i + \beta_j + (\alpha\beta)_{ij} + \epsilon_{ijk}\]

5.10.2 Multiple Variance Comparison F Test

5.10.3 Example

A study investigates the relationship between oxygen update and two explanatory variables: smoking, and type of stress test. A sample of \(n = 27\) persons, 9 non-smoking, 9 moderately-smoking, and 9 heavy-smoking are divided into three stress tests, bicycle, treadmill, and steps and their oxygen uptake was measured. Is oxygen uptake related to smoking status and type of stress test? Is there an interaction effect between smoking status and type of stress test?

library(dplyr)
library(ggplot2)
library(nortest)  # for Anderson-Darling test
library(stats)  # for anova

smoker <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 
            2, 2, 2, 2, 2, 2, 2, 2, 2, 
            3, 3, 3, 3, 3, 3, 3, 3, 3)
stress <- c(1, 1, 1, 2, 2, 2, 3, 3, 3,
            1, 1, 1, 2, 2, 2, 3, 3, 3,
            1, 1, 1, 2, 2, 2, 3, 3, 3)
oxytime <- c(12.8, 13.5, 11.2, 16.2, 18.1, 17.8, 22.6, 19.3, 18.9,
             10.9, 11.1, 9.8, 15.5, 13.8, 16.2, 20.1, 21.0, 15.9,
             8.7, 9.2, 7.5, 14.7, 13.2, 8.1, 16.2, 16.1, 17.8)
oxy <- data.frame(oxytime, smoker, stress)
oxy$smoker <- ordered(oxy$smoker,
                      levels = c(1, 2, 3),
                      labels = c("non-smoker", "moderate", "heavy"))
oxy$stress <- factor(oxy$stress,
                     labels = c("bicycle", "treadmill", "steps"))

lm_oxy <- lm(oxytime~smoker+stress+smoker*stress, data = oxy)
anova(lm_oxy)
## Analysis of Variance Table
## 
## Response: oxytime
##               Df  Sum Sq Mean Sq F value    Pr(>F)    
## smoker         2  84.899  42.449 12.8967 0.0003348 ***
## stress         2 298.072 149.036 45.2793 9.473e-08 ***
## smoker:stress  4   2.815   0.704  0.2138 0.9273412    
## Residuals     18  59.247   3.291                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

SFU BIO710