Drunk driving is one of the main causes of car accidents. Interviews with drunk drivers who were involved in accidents and survived revealed that one of the main problems is that drivers do not realize that they are impaired, thinking “I only had 1-2 drinks … I am OK to drive.”
A random sample of 20 drivers was chosen, and their reaction times in an obstacle course were measured before and after drinking two beers. The purpose of this study was to check whether drivers are impaired after drinking two beers.
## view data
## Rows: 20 Columns: 2
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## dbl (2): SubjectID, After
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Rows: 20 Columns: 2
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## dbl (2): SubjectID, Before
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
join two tables( Before and After)
## Joining, by = "SubjectID"
## # A tibble: 20 x 3
## SubjectID Before After
## <dbl> <dbl> <dbl>
## 1 1 6.25 6.85
## 2 2 2.96 4.78
## 3 3 4.95 5.57
## 4 4 3.94 4.01
## 5 5 4.85 5.91
## 6 6 4.81 5.34
## 7 7 6.6 6.09
## 8 8 5.33 5.84
## 9 9 5.15 4.19
## 10 10 4.88 5.75
## 11 11 5.75 6.25
## 12 12 5.26 7.23
## 13 13 3.16 4.55
## 14 14 6.65 6.42
## 15 15 5.49 5.25
## 16 16 4.05 5.59
## 17 17 4.42 3.96
## 18 18 4.99 5.93
## 19 19 5.01 6.03
## 20 20 4.69 3.72
## Joining, by = "SubjectID"
Differences between After and Before
## # A tibble: 20 x 4
## SubjectID Before After Difference
## <dbl> <dbl> <dbl> <dbl>
## 1 1 6.25 6.85 0.600
## 2 2 2.96 4.78 1.82
## 3 3 4.95 5.57 0.62
## 4 4 3.94 4.01 0.0700
## 5 5 4.85 5.91 1.06
## 6 6 4.81 5.34 0.53
## 7 7 6.6 6.09 -0.51
## 8 8 5.33 5.84 0.51
## 9 9 5.15 4.19 -0.96
## 10 10 4.88 5.75 0.87
## 11 11 5.75 6.25 0.5
## 12 12 5.26 7.23 1.97
## 13 13 3.16 4.55 1.39
## 14 14 6.65 6.42 -0.230
## 15 15 5.49 5.25 -0.240
## 16 16 4.05 5.59 1.54
## 17 17 4.42 3.96 -0.46
## 18 18 4.99 5.93 0.94
## 19 19 5.01 6.03 1.02
## 20 20 4.69 3.72 -0.97
-SubjectID represents the identification number of each drivers
-Before contains the time in seconds that takes the driver to react to the obstacle when he did not take 2 beers.
-After is the time that takes the driver to react to the obstacle after drinking 2 beers.
-Difference is the difference of time to react to obstacle between when the driver lucid versus when he is impaired by alcohol.
The histogram for the “Difference” column.
The histogram displays approximately a normal curve.This is a Student’s t-distribution of the difference of reaction time before and after taking 2 beers.
mean of the difference
## [1] 0.5035
Consider Ho = null hypothesis, and Ha= alternative hypotheses,
Ho: d= 0 do not reject the null hypothesis
Ha: d > 0 reject the null the hypothesis
##
## One Sample t-test
##
## data: before_after$Difference
## t = 2.6031, df = 19, p-value = 0.008734
## alternative hypothesis: true mean is greater than 0
## 98 percent confidence interval:
## 0.07706723 Inf
## sample estimates:
## mean of x
## 0.5035
With the level of confidence α=0.02, p-value = 0.008734.
Because p-value is very small and p-value < α, reject the null hypothesis Ho.
In conclusion, at 0.02 level of significance, there is enough evidence to conclude that the reaction time of drivers has increased after drinking 2 beers.
##
## One Sample t-test
##
## data: before_after$Difference
## t = 2.6031, df = 19, p-value = 0.01747
## alternative hypothesis: true mean is not equal to 0
## 98 percent confidence interval:
## 0.01231381 0.99468619
## sample estimates:
## mean of x
## 0.5035
98 percent confidence interval is [0.01231381 ,0.99468619] and like in the paired simple t.test, 0 is not include in the interval.
## [1] 0.7388286
## [1] 59.68117
The range for the additional distance (in feet) that an impaired driver when going 60 mph due to delayed reaction time will be [0.7388286 ; 59.68117].