DJIA               package:strucchange               R Documentation

_D_o_w _J_o_n_e_s _I_n_d_u_s_t_r_i_a_l _A_v_e_r_a_g_e

_D_e_s_c_r_i_p_t_i_o_n:

     Weekly closing values of the Dow Jones Industrial Average.

_U_s_a_g_e:

     data("DJIA")

_F_o_r_m_a_t:

     A weekly univariate time series of class '"zoo"' from 1971-07-01
     to 1974-08-02.

_S_o_u_r_c_e:

     Appendix A in Hsu (1979).

_R_e_f_e_r_e_n_c_e_s:

     Hsu D. A. (1979), Detecting Shifts of Parameter in Gamma Sequences
     with  Applications to Stock Price and Air Traffic Flow Analysis,
     _Journal of the American Statistical Association_, *74*, 31-40.

_E_x_a_m_p_l_e_s:

     data("DJIA")
     ## look at log-difference returns
     djia <- diff(log(DJIA))
     plot(djia)

     ## convenience functions
     ## set up a normal regression model which
     ## explicitely also models the variance
     normlm <- function(formula, data = list()) {
       rval <- lm(formula, data = data)
       class(rval) <- c("normlm", "lm")
       return(rval)
     }
     estfun.normlm <- function(obj) {
       res <- residuals(obj)
       ef <- NextMethod(obj)
       sigma2 <- mean(res^2)
       rval <- cbind(ef, res^2 - sigma2)
       colnames(rval) <- c(colnames(ef), "(Variance)")
       return(rval)
     }

     ## normal model (with constant mean and variance) for log returns
     m1 <- gefp(djia ~ 1, fit = normlm, vcov = meatHAC, sandwich = FALSE)
     plot(m1, aggregate = FALSE)
     ## suggests a clear break in the variance (but not the mean)

     ## dating
     bp <- breakpoints(I(djia^2) ~ 1)
     plot(bp)
     ## -> clearly one break
     bp
     time(djia)[bp$breakpoints]

     ## visualization
     plot(djia)
     abline(v = time(djia)[bp$breakpoints], lty = 2)
     lines(time(djia)[confint(bp)$confint[c(1,3)]], rep(min(djia), 2), col = 2, type = "b", pch = 3)

