Professional Documents
Culture Documents
2 Seatbelt Saves Lives
2 Seatbelt Saves Lives
We plot the timeseries for the variable drivers to explore the pattern.
##
## Call:
## lm(formula = drivers ~ kms + petrol + law, data = seatbelt)
##
## Residuals:
## Min 1Q Median 3Q Max
## -436.76 -175.66 -52.41 164.94 781.80
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.727e+03 1.699e+02 16.055 < 2e-16 ***
## kms -2.231e-02 6.956e-03 -3.207 0.00158 **
## petrol -6.743e+03 1.589e+03 -4.243 3.45e-05 ***
## law -1.988e+02 6.297e+01 -3.157 0.00186 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 239 on 188 degrees of freedom
## Multiple R-squared: 0.3299, Adjusted R-squared: 0.3192
## F-statistic: 30.85 on 3 and 188 DF, p-value: 2.901e-16
We notice that all three are significant. but R2 seems to be low so this model does not
explain the variance as much.
## Wald test:
## ----------
##
## Chi-squared test:
## X2 = 9473.3, df = 4, P(> X2) = 0.0
The pvalue of model indicates the rank is statistically significant. The chi squared is a little
high, so this model might not be a great fit in general.
We now plot the time series data for variables law and kms to explore the
pattern in the data.
We also plot the time series to explore the patten for the variable petrol.
What we see is that the more kms driven, leads to more number of accidents and deaths,
which seems like an obvious intuition.
We try to understand the auto-correlation between drivers and petrol using
the ccf function
With the increase in petrol consumption, the number of accident increases, which also
confirms a straight forward intuition from the data.
We now use the arima function to find better models. First we use only the
drivers and law time series variables.
## Series: driversT
## Regression with ARIMA(1,0,1)(0,1,1)[12] errors
##
## Coefficients:
## ar1 ma1 sma1 xreg
## 0.9338 -0.6020 -0.8596 -317.7305
## s.e. 0.0467 0.1151 0.0777 86.6232
##
## sigma^2 = 17346: log likelihood = -1139.85
## AIC=2289.7 AICc=2290.04 BIC=2305.66
We notice that around 317 fewer people die per month because of the seatbelt safety law.
We see that the time series is significant for lawst and the petrolst variabless.
We then plot a model with the tslm function and check statistical
significance.
##
## Call:
## tslm(formula = driversT ~ kmssT + petrolsT + lawsT + trend +
## season)
##
## Residuals:
## Min 1Q Median 3Q Max
## -322.51 -78.45 -16.15 75.26 311.01
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1676.7643 187.3162 8.952 4.86e-16 ***
## kmssT 0.0742 0.0162 4.580 8.77e-06 ***
## petrolsT -4792.2055 951.9724 -5.034 1.18e-06 ***
## lawsT -239.6581 37.3698 -6.413 1.27e-09 ***
## trend -4.2257 0.6937 -6.091 6.87e-09 ***
## season2 -172.2945 46.9082 -3.673 0.000318 ***
## season3 -267.6655 55.5676 -4.817 3.13e-06 ***
## season4 -412.4100 60.1768 -6.853 1.17e-10 ***
## season5 -357.2234 72.2698 -4.943 1.78e-06 ***
## season6 -418.4934 74.4215 -5.623 7.24e-08 ***
## season7 -430.7031 90.9932 -4.733 4.52e-06 ***
## season8 -452.9997 97.6762 -4.638 6.85e-06 ***
## season9 -271.2925 73.8564 -3.673 0.000318 ***
## season10 -80.5607 64.8660 -1.242 0.215905
## season11 233.0279 51.2927 4.543 1.03e-05 ***
## season12 399.9386 48.0259 8.328 2.24e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 132.3 on 176 degrees of freedom
## Multiple R-squared: 0.8077, Adjusted R-squared: 0.7913
## F-statistic: 49.27 on 15 and 176 DF, p-value: < 2.2e-16
We see that the R2 is much much higher, this model explain best the data. We still see that
the law is statistically significant and helps with the reduction in the numbers of accidents
resulting in deaths. So as a conclusion , I would agree that implementing the law of seatbelt
safety has reduced the number of accidents