Homework 8: Multiway ANOVA
Objective:
- Learn how to use Rcmdr to analyze 2-way data
- To learn how to recognize and identify the hypotheses of a 2-way ANOVA design from the stacked worksheet.
- To learn about transforming data to achieve assumptions
- To learn about “marginality” and how choice of when factor enters model if has an effect on conclusions.
Homework 8 expectations
Read through the entire homework before starting to answer a question. You are expected to have read the chapter and to have completed preceding homework. Answers are provided to odd numbered problems — turn in your work for even numbered problems.
How to work this homework
You may work together, but each of your must turn in your own report. Don’t “plagiarize” from each other. Do include in your report who you worked with.
What to turn in: A pdf file containing your R code, statistical results, and your answer to the questions. Use of RMarkdown recommended; however copy/paste into a word document is also acceptable.
Submit your work to CANVAS. Obey proper file naming formats.
Resources for this homework
Chapter 12. Mike’s Biostatistics Book
Chapter 14. Mike’s Biostatistics Book
Mike’s Workbook for Biostatistics: A quick look at R and R Commander, Part01 – Part10 and previous homework pages presented in this workbook.
Additional R commands and or code provided below.
Questions
You’ll need to load the ex2way data set into R/Rcmdr. Data set published at end of this page
- How many variables? Which variables are the factors? How many levels in each variable/factor?
- Write out all null hypotheses that can be tested in this 2-way ANOVA problem.
- Write out the equation for the model.
- Is this a crossed or nested design?
- This is an ANOVA problem; What assumptions are being made to conduct the ANOVA?
- What is the name of the nonparametric alternative test to a 2-way ANOVA?
- Generate a Plot of Means that conveys the responses given the experimental design.
- Test normality.
- Test equal variances.
- If assumptions are violated, create two new variables, modified from the response variable
(a) rank the response variable
Rcmdr: Manage variables… –> Compute new variable
name = rank(Response)
(b) log10 transform the variable
Rcmdr: Manage variables… –> Compute new variable
name = log10(Response)
**Recheck #6 and/or #7 (which ever was violated) on the log10-transformed response variable and check to see if assumptions now valid - Conduct a proper test of the 2-way model on appropriate response variable (i.e., assumptions met).
- a) What effects if any does the selection of type of test (sequential, Type II, or Type III) have on your conclusions?
b) Balanced design?
c) Unbalanced design?
Hint: In other words, go back to the data and deliberately remove some data to make the groups unbalanced. Repeat your analyses, but change sequential, Type II, or Type III options and report changes to P-values, if any.
R or Rcmdr commands
myData <- read.table(header=TRUE, sep="t", text = " insert your data table here ") head(myData)
Test normality.
Rcmdr → Statistics → Summaries → Test for normality
Multiway ANOVA: 2 options
Option 1. Rcmdr: Statistics → Means → Multi-way ANOVA
Option 2. Rcmdr → Statistics → Fit models → Linear model
then, to get the summary table, Rcmdr: Statistics → Models → Hypothesis tests → ANOVA table…
Data
ex2way data set
Factor1 | Factor2 | Response |
G | A | 8.796347 |
G | A | 11.456232 |
G | A | 10.067908 |
G | B | 9.684717 |
G | B | 12.440822 |
G | B | 11.241605 |
G | C | 8.262376 |
G | C | 8.145118 |
G | C | 7.882312 |
H | A | 14.46131 |
H | A | 14.46038 |
H | A | 13.18818 |
H | B | 10.062405 |
H | B | 9.780971 |
H | B | 9.845786 |
H | C | 6.734254 |
H | C | 6.198078 |
H | C | 5.954699 |
I | A | 23.59453 |
I | A | 21.92648 |
I | A | 21.89414 |
I | B | 20.75972 |
I | B | 20.12655 |
I | B | 20.65819 |
I | C | 17.04579 |
I | C | 17.63584 |
I | C | 16.9222 |
/MD