UKDriverDeaths package:datasets R Documentation _R_o_a_d _C_a_s_u_a_l_t_i_e_s _i_n _G_r_e_a_t _B_r_i_t_a_i_n _1_9_6_9-_8_4 _D_e_s_c_r_i_p_t_i_o_n: 'UKDriverDeaths' is a time series giving the monthly totals of car drivers in Great Britain killed or seriously injured Jan 1969 to Dec 1984. Compulsory wearing of seat belts was introduced on 31 Jan 1983. 'Seatbelts' is more information on the same problem. _U_s_a_g_e: UKDriverDeaths Seatbelts _F_o_r_m_a_t: 'Seatbelts' is a multiple time series, with columns '_D_r_i_v_e_r_s_K_i_l_l_e_d' car drivers killed. '_d_r_i_v_e_r_s' same as 'UKDriverDeaths'. '_f_r_o_n_t' front-seat passengers killed or seriously injured. '_r_e_a_r' rear-seat passengers killed or seriously injured. '_k_m_s' distance driven. '_P_e_t_r_o_l_P_r_i_c_e' petrol price. '_V_a_n_K_i_l_l_e_d' number of van ('light goods vehicle') drivers. '_l_a_w' 0/1: was the law in effect that month? _S_o_u_r_c_e: Harvey, A.C. (1989) _Forecasting, Structural Time Series Models and the Kalman Filter._ Cambridge University Press, pp. 519-523. Durbin, J. and Koopman, S. J. (2001) _Time Series Analysis by State Space Methods._ Oxford University Press. _R_e_f_e_r_e_n_c_e_s: Harvey, A. C. and Durbin, J. (1986) The effects of seat belt legislation on British road casualties: A case study in structural time series modelling. _Journal of the Royal Statistical Society_ series B, *149*, 187-227. _E_x_a_m_p_l_e_s: require(stats); require(graphics) ## work with pre-seatbelt period to identify a model, use logs work <- window(log10(UKDriverDeaths), end = 1982+11/12) par(mfrow = c(3,1)) plot(work); acf(work); pacf(work) par(mfrow = c(1,1)) (fit <- arima(work, c(1,0,0), seasonal = list(order= c(1,0,0)))) z <- predict(fit, n.ahead = 24) ts.plot(log10(UKDriverDeaths), z$pred, z$pred+2*z$se, z$pred-2*z$se, lty = c(1,3,2,2), col = c("black", "red", "blue", "blue")) ## now see the effect of the explanatory variables X <- Seatbelts[, c("kms", "PetrolPrice", "law")] X[, 1] <- log10(X[, 1]) - 4 arima(log10(Seatbelts[, "drivers"]), c(1,0,0), seasonal = list(order= c(1,0,0)), xreg = X)