The Analysis of Reaction Time for Various Factors

Haseong Kim

999372325

STA490Y1Y

Purpose

The purpose of this project is to find out the probable factor that may affect the reaction times of the 13 students in STA490 course at the University of Toronto.

Data

1. Variables

Each students recorded their reaction time of six time points (9:00, 12:00, 15:00, 18:00, 21:00, 24:00) on one day of a week.

The recorded variables are:

2. Data Summary

##            Circadian.rhythm gender hours.of.sleep.the.night.before
##                    :70      F:30   Min.   :7.00                   
##  Definitely Evening: 1      M:48   1st Qu.:7.00                   
##  Moderately Evening: 1             Median :7.50                   
##  Neither           : 6             Mean   :7.64                   
##                                    3rd Qu.:8.00                   
##                                    Max.   :9.00                   
##                                                                   
##  day.of.the.week caffeine.consumer      time    Hours.since.last.meal
##          : 6     N:60              21:00  :12   Min.   : 0.00        
##  Monday  :36     Y:18              12:00  :11   1st Qu.: 1.38        
##  Sunday  :24                       15:00  :11   Median : 2.50        
##  Thursday: 6                       0:00   :10   Mean   : 3.97        
##  Tuesday : 6                       18:00  :10   3rd Qu.: 5.00        
##                                    9:00   :10   Max.   :20.00        
##                                    (Other):14   NA's   :7            
##  caffeine.in.last.2h reaction.time  
##   :12                Min.   :0.199  
##  N:59                1st Qu.:0.357  
##  Y: 7                Median :0.399  
##                      Mean   :0.512  
##                      3rd Qu.:0.592  
##                      Max.   :1.988  
## 

Analysis

1. Individual Reaction Time

A. Boxplot of Reaction Time

The reaction time for individual students is boxplotted. From the plots, it is observed that the majority of the students have the reaction time below 1.0 seconds. Also, the boxplot tells each individuals' median reaction time. The seventh observtion has an outlier.

plot of chunk unnamed-chunk-2

B. Histogram of Reaction Time

Right skewed

plot of chunk unnamed-chunk-3

C. QQ Plot of Reaction Time

plot of chunk unnamed-chunk-4

2. Female vs. Male Reaction Time

A. With Outlier

This boxplot shows the mean reaction time between female and male students. There is an outlier from the female students, and the female has lower median of reaction time.

plot of chunk unnamed-chunk-5

## 
##  Welch Two Sample t-test
## 
## data:  femaleTime and maleTime
## t = 2.2, df = 35.79, p-value = 0.03438
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.01253 0.30978
## sample estimates:
## mean of x mean of y 
##    0.6111    0.4500

B. Without Outlier

After getting rid of the outlier from the female students, it is observed that the median of the reaction time of females are lower than that of males. This changes the statistical significance as well since the p-value become 0.034 when with outlier, it is 0.055. When without the outlier from the female, there's not enough evidence to say the mean of reaction time between female and male are different. However, with the outlier, there is a sufficient evidence of the difference of the mean between the female and male.

plot of chunk unnamed-chunk-6

## 
##  Welch Two Sample t-test
## 
## data:  femaleTime2 and maleTime2
## t = 1.98, df = 39.53, p-value = 0.05471
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.002409  0.229761
## sample estimates:
## mean of x mean of y 
##    0.5637    0.4500

3. Absorbance of Food Effects on Reaction Time

The plot of the effects of the hours since last meal on the reaction times of the students seems random.

plot of chunk unnamed-chunk-7

4. Caffeine Consumption Effects on Reaction Time

1) Regular Caffeine Consumption With Outlier

It is observed that with both with and without outliers, regular caffeine consumers have lower reaction time.

plot of chunk unnamed-chunk-8

## 
##  Welch Two Sample t-test
## 
## data:  CaffeineYes and CaffeineNo
## t = -4.865, df = 65.94, p-value = 7.434e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.2756 -0.1152
## sample estimates:
## mean of x mean of y 
##    0.3617    0.5571

2) Regular Caffeine Consumption without Outlier

plot of chunk unnamed-chunk-9

## 
##  Welch Two Sample t-test
## 
## data:  CaffeineYes and CaffeineNo
## t = -5.265, df = 68.06, p-value = 1.545e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.2360 -0.1063
## sample estimates:
## mean of x mean of y 
##    0.3617    0.5328

4. Simple Regression

1) Hours Since Last Meal Effect on Reaction Time

The p-value is small for the hours since last meal. Thus, we cannot reject non-zero slope, indicating the longer time we have not eaten, the quicker the reaction time. The graph does not seem to indicate this, but the regression test did.

## 
## Call:
## lm(formula = y1 ~ x1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.2455 -0.0911 -0.0615  0.0169  0.5822 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.40730    0.02610   15.60   <2e-16 ***
## x1           0.01061    0.00456    2.33    0.023 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.158 on 69 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.0727, Adjusted R-squared:  0.0593 
## F-statistic: 5.41 on 1 and 69 DF,  p-value: 0.023

plot of chunk unnamed-chunk-10

2) Hours of Sleep Effects on Reaction Time

The p-value for the slope is not convincing to reject null hypothesis. we have a negative slope which is not expected, but since the p-value is 8.9% we cannot reject null hypothesis that it is 0. Also, we must clean out some of these outliers. Lastly, we are only looking at a two hour difference in sleep so we would not expect much.

## 
## Call:
## lm(formula = y1 ~ w1)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -0.298 -0.160 -0.108  0.161  1.424 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   1.1329     0.3622    3.13   0.0025 **
## w1           -0.0813     0.0472   -1.72   0.0894 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.274 on 76 degrees of freedom
## Multiple R-squared:  0.0375, Adjusted R-squared:  0.0248 
## F-statistic: 2.96 on 1 and 76 DF,  p-value: 0.0894

plot of chunk unnamed-chunk-11

5. Multivariable Regression

Effects of Hours Since Last Meal and Hours of Sleep on Reaction Time

It shows that there is not enough evidence to reject the null hypothesis, and the slope is zero. This infers that the hours of sleep does not affect on reaction time but the hours since last meal does. It is consistent from the previous analysis.

## 
## Call:
## lm(formula = y1 ~ w1 + x1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.2474 -0.0851 -0.0630  0.0289  0.5600 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  0.28432    0.22572    1.26    0.212  
## w1           0.01582    0.02883    0.55    0.585  
## x1           0.01093    0.00462    2.36    0.021 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.159 on 68 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.0768, Adjusted R-squared:  0.0496 
## F-statistic: 2.83 on 2 and 68 DF,  p-value: 0.0661