Two-way ANOVA on a self-run experiment testing how caffeine dose and audio/visual distractions affect reaction time.
R
ANOVA
Experimental Design
Author
Spencer Payne
Show the code
library(mosaic)library(DT)library(pander)library(car)library(tidyverse)library(dplyr)library(lattice)library(lmtest)# Record your data from your own mini experiment in Excel.# Save the data as a .csv file in the Data folder of the Statistics-Notebook.# Read in the dataCaff <-read_csv("data/MyTwoWayANOVA.csv")
Background and Hypothesis
The following data was taken from individuals to understand attention span and how things like external stimuli and caffeine can affect attention. The data was collected as subjects participated in tests designed to show subjects reaction time. Each participant took the test with and without caffeine and with and without external stimuli. Caffeine content ranged from 0mg, 50mg, and 100mg, each taken 45 min prior to engaging with the test. External stimuli consisted of no stimuli, audio stimuli (in the form of random pop songs), visual stimuli (in which subjects watched a video of ping pong practice), and combined audio and visual stimuli (where both the video and the music were played).
Of the whole experiment, two factors can effect the reaction time of the participants which are caffeine intake and stimuli. An ANOVA test will be performed on the data using the following hypothesis
By understanding the p-values we can see that each of the factors and their levels have a significant effect on the reaction time of the participants, each being below the level of significance. Distraction at 0.00000000000102 and caffeine at 0.0000000000372
Graphical Summaries
Modeling the results on using plots for each factor will aid in understanding the results of the ANOVA test.
These graphs show us the effect that each of the factors and its levels have individually on the reaction times.
Diagnostic Plots
To check the normality of the data and assure ourselves that the ANOVA is valid we can check the residuals and QQPlot as is shown below.
Show the code
par(mfrow=c(1,2))plot(Caff.aov, which=1:2)
Conclusion
Each of these summaries come together to show us the understanding we need about our data and the relationship each factor has with the others. Our diagnostic plots show us the data we have collected from our participants is usable and consistent with general population data. This helps us to understand the validity of the further analysis we have done on the data. Our XYPlots help to show us the rough relationship that distractions and caffeine levels have with reaction times. Hypothesizing from the graphic plots we can go forward in our analysis. After concluding that we believe that their is a relationship between reaction time and caffeine intake levels and reaction time and outside distraction, we move onto our analysis. say that, using a two-way ANOVA, caffeine and different distraction inputs have a significant relationship on reaction time.