## Warning in chisq.test(data_2015$Number.of.Vehicles,
## data_2015$Casualty.Severity): Chi-squared approximation may be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  data_2015$Number.of.Vehicles and data_2015$Casualty.Severity
## X-squared = 58.005, df = 12, p-value = 5.201e-08
Fatal Serious Slight
6 133 532
9 163 1444
1 22 250
0 2 55
0 1 34
0 1 6
0 0 5
## [1] 0
count_ny uk_2015
count_ny 1.0000 0.7945
uk_2015 0.7945 1.0000

Interpretation of the results:

According to the results, it seems that there’s a strong positive correlation between the variables.

## 
## Call:
## lm(formula = count_ny ~ uk_2015 + uk_2016, data = final_hour_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1053.49  -336.21   -47.73   358.62   664.27 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   637.34     148.54   4.291 0.000324 ***
## uk_2015        57.06      24.41   2.338 0.029390 *  
## uk_2016        25.10      28.96   0.867 0.395770    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 456.2 on 21 degrees of freedom
## Multiple R-squared:  0.644,  Adjusted R-squared:   0.61 
## F-statistic: 18.99 on 2 and 21 DF,  p-value: 1.954e-05

## 
##  Shapiro-Wilk normality test
## 
## data:  vec_2015
## W = 0.67541, p-value < 2.2e-16
## 
##  Shapiro-Wilk normality test
## 
## data:  vec_2016
## W = 0.72839, p-value < 2.2e-16

Result/conclusion for Shapiro-Wilks test:

since both tests turned significant results, we can assume the data for both vectors isn’t normally distributed.

However, since the sample size for both vectors is dramatically greater than 30, we can overlook that and still use t-test assuming normality of the results.

Nonetheless, we’ll use both tests and conclude based upon both of them.

## 
##  F test to compare two variances
## 
## data:  vec_2015 and vec_2016
## F = 0.71111, num df = 202, denom df = 188, p-value = 0.01747
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.5361349 0.9418266
## sample estimates:
## ratio of variances 
##          0.7111085

Variance’s test results:

It turned that variances are significantly different - so we need to assume that while using the t-test procedure

## 
##  Welch Two Sample t-test
## 
## data:  data_2015_relevant$Number.of.Vehicles and data_2016_relevant$Number.of.Vehicles
## t = -0.84809, df = 368.86, p-value = 0.3969
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.15863568  0.06303269
## sample estimates:
## mean of x mean of y 
##  1.788177  1.835979

T-Test Result:

According to the t-test procedure - there’s no significance difference between 2015 and 2016; that means that we fail to reject the null hypothesis (H0 is the correct hypothesis).

## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  data_2015_relevant$Number.of.Vehicles and data_2016_relevant$Number.of.Vehicles
## W = 18727, p-value = 0.6183
## alternative hypothesis: true location shift is not equal to 0

Wilcoxon results:

Wilcoxon test led to the same result: there’s no significant difference in number of vehicles involved for both 2015 and 2016.

Year_2015 Year_2016
Year_2015 1.0000 0.9999
Year_2016 0.9999 1.0000

Year_2015 Year_2016
Year 2015 2016
Count 203 189
mean 1.788177 1.835979
median 2 2
min 1 1
max 3 4
sd 0.5068424 0.6010423
var 0.2568892 0.3612518