decompose               package:stats               R Documentation

_C_l_a_s_s_i_c_a_l _S_e_a_s_o_n_a_l _D_e_c_o_m_p_o_s_i_t_i_o_n _b_y _M_o_v_i_n_g _A_v_e_r_a_g_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Decompose a time series into seasonal, trend and irregular
     components using moving averages.  Deals with additive or
     multiplicative seasonal component.

_U_s_a_g_e:

     decompose(x, type = c("additive", "multiplicative"), filter = NULL)

_A_r_g_u_m_e_n_t_s:

       x: A time series.

    type: The type of seasonal component. Can be abbreviated.

  filter: A vector of filter coefficients in reverse time order (as for
          AR or MA coefficients), used for filtering out the seasonal
          component. If 'NULL', a moving average with symmetric window
          is performed.

_D_e_t_a_i_l_s:

     The additive model used is:

                      Y[t] = T[t] + S[t] + e[t]

     The multiplicative model used is:

                      Y[t] = T[t] * S[t] * e[t]


     The function first determines the trend component using a moving
     average (if 'filter' is 'NULL', a symmetric window with equal
     weights is used), and removes it from the time series.  Then,  the
     seasonal figure is computed by averaging, for each time unit, over
     all periods. The seasonal figure is then centered. Finally, the
     error component is determined by removing trend and seasonal
     figure (recycled as needed) from the original time series.

_V_a_l_u_e:

     An object of class '"decomposed.ts"' with following components: 

seasonal: The seasonal component (i.e., the repeated seasonal figure)

  figure: The estimated seasonal figure only

   trend: The trend component

  random: The remainder part

    type: The value of 'type'

_N_o_t_e:

     The function 'stl' provides a much more sophisticated
     decomposition.

_A_u_t_h_o_r(_s):

     David Meyer David.Meyer@wu-wien.ac.at

_R_e_f_e_r_e_n_c_e_s:

     M. Kendall and A. Stuart (1983) The Advanced Theory of Statistics,
     Vol.3, _Griffin_, 410-414.

_S_e_e _A_l_s_o:

     'stl'

_E_x_a_m_p_l_e_s:

     require(graphics)

     m <- decompose(co2)
     m$figure
     plot(m)

     ## example taken from Kendall/Stuart
     x <- c(-50, 175, 149, 214, 247, 237, 225, 329, 729, 809, 
            530, 489, 540, 457, 195, 176, 337, 239, 128, 102, 232, 429, 3, 
            98, 43, -141, -77, -13, 125, 361, -45, 184)
     x <- ts(x, start = c(1951, 1), end = c(1958, 4), frequency = 4)
     m <- decompose(x)
     ## seasonal figure: 6.25, 8.62, -8.84, -6.03
     round(decompose(x)$figure / 10, 2)

