Vol. 3: Testing Mean Differences
Welcome
Blocked Notes
Code and Output
The Authors
Why choose R ?
FYI
1
Intro: Ihno’s Experiemnt
1.1
Background of Data
1.2
Import & Wrangle the Data
1.3
Overview
1.3.1
Dimentions (size) of the dataset
1.3.2
Variable Names
1.3.3
Quick Glimpse
1.3.4
Top and Bottom Rows
2
Intro: Cancer Experiemnt
2.1
Source of Data
2.2
Description of the Study
2.3
Variables
2.4
Import Data
2.5
Wrangle Data
2.6
Overview
2.6.1
Dimentions (size) of the dataset
2.6.2
Variable Names
2.6.3
Quick Glimpse
2.6.4
Top and Bottom Rows
3
ONE SAMPLE t-TEST: for the MEAN
3.1
Exploratory Data Analysis: i.e. the eyeball method
3.1.1
Mean and SD
3.2
Assumptions
3.2.1
Random Sampling
3.2.2
Normality
3.3
Inference
3.3.1
All Defaults
3.3.2
Confidence Level other than 95%
3.3.3
One-Sided Test, instead of Two
3.3.4
Restrict to a Subsample
3.4
Inho example
4
t TEST FOR THE DIFFERENCE IN 2 MEANS, INDEPENDENT SAMPLES
4.1
Exploratory Data Analysis: i.e. the eyeball method
4.1.1
Means and SDs
4.1.2
Stacked Histograms
4.1.3
Side-by-Side Boxplots
4.2
Assumptions
4.2.1
1. Independence
4.2.2
2. Normality
4.2.3
2. HOV
4.3
Inference
4.3.1
Pooled Variance Test
4.3.2
Seperate Variance Test
5
One-Way ANOVA: Code
5.1
Prepare Work
5.1.1
Ensure the Data is in “long” Format
5.1.2
Check the Variables
5.2
Exploratory Data Analysis
5.2.1
Compute Summary Statistics
5.2.2
Plot the Observed Data
5.3
Assumption Checks
5.3.1
Independent, Random Samples
5.3.2
Normality of the DV in each Group
5.3.3
Homogeneity of Variance (HOV) in the DV between groups
5.4
One-way ANOVA Model
5.4.1
Fit & Save the Model
5.4.2
Basic Output - stored name of model
5.4.3
Fuller Output - add $Anova on model name
5.5
Followup-tests
5.5.1
Calculate Estimated Marginal Means
5.5.2
Plot Estimated Marginal Means
5.5.3
All Pairwise Comparisons
5.5.4
Effect Size for Pairwise Comparisons
5.5.5
Contrast Statements
5.6
APA Write-up
5.6.1
Methods Section
5.6.2
Results Section
6
Poison Example: 1 & 2-way ANOVA
6.1
Prepare for Modeling
6.1.1
Ensure the Data is in “long” Format
6.2
Example 1) Survival Time by Poison Type
6.2.1
Research Question
6.2.2
Exploratory Data Analysis
6.2.3
Assumption Checks
6.2.4
Fitting One-way ANOVA Model
6.2.5
Followup-tests
6.2.6
APA Write Up
6.3
Example 2) Survival Time by Treatment Type
6.3.1
Parepare for Analysis
6.3.2
Fitting One-way ANOVA Model
6.3.3
Followup-tests
6.4
Example 3) Survival Time by Both Poisson & Treatment Type
6.4.1
Parepare for Analysis
6.4.2
Fitting Two-way ANOVA Model
6.4.3
Followup-tests
7
Helpful Functions
7.1
P-value Formatting
7.2
APA Table Formatting
8
Repeated Measures ANOVA
8.1
Tutorial - Fitting RM ANOVA Models with afex::aov_4()
8.2
Words Recalled Data Example (Chapter 15, section A)
8.2.1
Data Prep
8.2.2
One-Way Independent ANOVA
8.2.3
One-Way RM ANOVA
8.3
Another Example - Weight Loss
8.3.1
Restructure the data from wide to long format
8.3.2
Does weight long change over time?
9
Mixed Design ANOVA
9.1
Tutorial - Fitting Mixed Design ANOVA Models with
afex::aov_4()
9.2
Words Recalled Data Example (Chapter 16, section A)
9.2.1
Data Prep
9.2.2
One-Way RM ANOVA
9.2.3
Mixed ANOVA
9.3
Conclusion
References
Published with bookdown
Encyclopedia of Quantitative Methods in R, vol. 3: Testing Mean Differences
References
Wickham, Hadley, Evan Miller, and Danny Smith. 2022.
Haven: Import and Export SPSS, Stata and SAS Files
.
https://CRAN.R-project.org/package=haven
.