library(mosaic)
library(DT)
library(pander)
library(car)
library(tidyverse)
library(plotly)

# 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 data
typeSpeed <- read_csv("../../Data/Type_data.csv") 

# Convert columns "Stance" and "Music" from character types to factors.
typeSpeed <- typeSpeed %>% 
  mutate(
    Stance = as.factor(Stance),
    Music = as.factor(Music)
  )

Data Collection

Posture and body position is considered to be important when typing, and music has been said to help or hurt focus depending on the person and music: We hope to see if these effects have a significant effect on typing speed. Typing speed and accuracy were recorded from type-races on nitrotype.com in different circumstances. Type-races were performed with the laptop in the participants lap while sitting on the floor with their back against the wall, and more were performed with the laptop on a table sitting-upright. In both situations, type-races were performed while listening to verbal music(V) shuffled from a favorite playlist, high-bpm non-verbal study music(NV), and no music.

datatable(typeSpeed, options = list(lengthMenu= c(5,10,20)))

Hypothesis

This analysis will use the two-way ANOVA with the factors of music and stance and their interaction. This gives us three hypotheses:

  1. Does the type of music effect the average typing speed?

\[H_0: \mu_{NV} = \mu_V = \mu_N = \mu\] \[H_a: \mu_i \neq \mu \text{ for at least one music setting i = NV, V, or N}\]

  1. Does the stance/sitting position effect the average typing speed? \[H_0: \mu_{table} = \mu_{lap}\] \[H_a: \mu_{table} \neq \mu_{lap}\]
  2. Does the interaction of stance and music effect the average typing speed? \[H_0: \text{the effect of music on typing speed is the same regardless of stance}\] \[H_a: \text{the effect of music on typing speed is different regardless of stance}\]

For this analysis, a significance factor of \(\alpha = 0.05\) will be used

Analysis

Lets take a look at our data:

ggplot(typeSpeed, aes(x= Stance, y= WPM, fill= Music)) +
  geom_boxplot(fill='lightgray', notch=TRUE) +
  geom_dotplot(binaxis= 'y', stackdir= 'up',
               position=position_dodge(0.2)) +
  labs(title="Typing Speed Based on Laptop Position") +
  theme_light()

Using the notched box-plot, we can see that there doesn’t seem to be a significant difference in WPM regardless of the position of the laptop. (Note: Due to our sample size, our notches are bigger than our inner-quartile range, causing the box-plots to display with Q1 and Q3 appearing inside of the notch)

ggplot(typeSpeed, aes(x= Music, y= WPM, fill= Music)) +
  geom_boxplot(fill='lightgray', notch=TRUE) +
  geom_dotplot(binaxis= 'y', stackdir= 'up',
               position=position_dodge(0.2)) +
  labs(title="Typing Speed Based on Music") +
  theme_light()

Looking at the data from the perspective of the Music, we see that the type of music doesn’t play a significant effect on the typing speed; however, it is noteworthy that the fastest time comes from the Non-Vocal music, which may be of value if one wishes to push their limits and just get a faster time, although more analysis must be performed to affirm that conjecture.

  favstats(WPM ~ Music, data = typeSpeed)[-9] %>% 
    pander(caption= "WPM measuered with changing Music")
WPM measuered with changing Music
Music min Q1 median Q3 max mean sd missing
None 83 87.25 89.5 91.75 96 89.5 4.506 0
NV 85 88.25 93 103 112 96 10.7 0
V 82 89.75 92.5 93 104 92.17 7.139 0
  favstats(WPM ~ Stance, data = typeSpeed)[-9] %>% 
    pander(caption= "WPM measuered with changing Stance")
WPM measuered with changing Stance
Stance min Q1 median Q3 max mean sd missing
Lap 87 89 93 97 105 94.44 6.635 0
Table 82 85 89 92 112 90.67 8.944 0

We can see in from both of these tables, that there are no major differences. All the means range from \(\approx 90 \text{ to } 96\) WPM, and the medians range from \(89 \text{ to } 93\) WPM

ggplot(typeSpeed, aes(x=Music, y=WPM, group=Stance, color=Stance)) +
  geom_point(color='firebrick') +
  stat_summary(fun='mean', geom='line') +
  labs(title="Typing Speed Based on Non-Vocal(NV), Vocal(V), and No Music(None)",
       y="WPM",
       x="Type of Music") +
  theme_light()

Here we see Non-vocal music producing the highest WPM on average. Let’s test to see if that difference is significant.

By performing the ANOVA, we get a test statistic and p-value for all of the hypotheses above.

typeSpeed.aov <- aov(WPM ~ Music + Stance + Music:Stance, data=typeSpeed)
summary(typeSpeed.aov) %>% 
  pander()
Analysis of Variance Model
  Df Sum Sq Mean Sq F value Pr(>F)
Music 2 128.1 64.06 0.9093 0.4288
Stance 1 64.22 64.22 0.9117 0.3585
Music:Stance 2 18.78 9.389 0.1333 0.8765
Residuals 12 845.3 70.44 NA NA

Our ANOVA tells us that the Music, Stance, and their interaction do not produce significant differences the resulting typing speed.

Lets look at how much we can trust this ANOVA test, by looking at the normality and variance of the of our data.

par(mfrow = c(1,2))
plot(typeSpeed.aov, which = 1:2)

Our Q-Q plot looks sufficiently normal, while our variance is great enough to warrant weakened ANOVA results; the variance in the group around 95 WPM appears to have more than twice the variance of the group just before 92. This does not mean that our results are not true, but rather that we cannot put all our confidence into the results of the ANOVA.

Interpetation

All of our p-values were above our significance factor of \(\alpha=0.05\); therefore, there is insufficient evidence to reject our null hypotheses: Laptop position(stance), music, and their interaction do not have a significant impact on the speed of typing(WPM).

We did observe from our sample data that the average typing speed was highest with Non-Verbal music, and the laptop resting in the participant’s lap; however, this conclusion does not have sufficient evidence to prove true universally.This high average is also heavily due to a high outlier in Non-Verbal Music; as mentioned prior, the medians of all categories are very close: \(89 \text{ to } 93\) WPM.