decaverage              package:pastecs              R Documentation

_T_i_m_e _s_e_r_i_e_s _d_e_c_o_m_p_o_s_i_t_i_o_n _u_s_i_n_g _a _m_o_v_i_n_g _a_v_e_r_a_g_e

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

     Decompose a single regular time series with a moving average
     filtering. Return a 'tsd' object. To decompose several time series
     at once, use 'tsd()' with the argument 'method="average"'

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

     decaverage(x, type="additive", order=1, times=1, sides=2, ends="fill",
             weights=NULL)

_A_r_g_u_m_e_n_t_s:

       x: a regular time series ('rts' under S+ and 'ts' under R) 

    type: the type of model, either 'type="additive"' (by default), or
          'type="multiplicative"' 

   order: the order of the moving average (the window of the average
          being 2*order+1), centered around the current observation or
          at left of this observation depending upon the value of the
          'sides' argument. Weights are the same for all observations
          within the window. However, if the argument 'weights' is
          provided, it supersedes 'order'. One can also use
          'order="periodic"'. In this case, a deseasoning filter is
          calculated according to the value of 'frequency' 

   times: The number of times to apply the method (by default, once) 

   sides: If 2 (by default), the window is centered around the current
          observation. If 1, the window is at left of the current
          observation (including it) 

    ends: either "NAs" (fill first and last values that are not
          calculable with NAs), or "fill" (fill them with the average
          of observations before applying the filter, by default), or
          "circular" (use last values for estimating first ones and
          vice versa), or "periodic" (use entire periods of contiguous
          cycles, deseasoning) 

 weights: a vector indicating weight to give to all observations in the
          window. This argument has the priority over 'order' 

_D_e_t_a_i_l_s:

     This function is a wrapper around the 'filter()' function and
     returns a 'tsd' object. However, it offers more methods to handle
     ends.

_V_a_l_u_e:

     A 'tsd' object

_A_u_t_h_o_r(_s):

     Frdric Ibanez (ibanez@obs-vlfr.fr), Philippe Grosjean
     (phgrosjean@sciviews.org)

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

     Kendall, M., 1976. _Time-series._ Charles Griffin & Co Ltd. 197
     pp.

     Laloire, J.C., 1972. _Mthodes du traitement des chroniques._
     Dunod, Paris, 194 pp.

     Malinvaud, E., 1978. _Mthodes statistiques de l'conomtrie._
     Dunod, Paris. 846 pp.

     Philips, L. & R. Blomme, 1973. _Analyse chronologique._ Universit
     Catholique de Louvain. Vander ed. 339 pp.

_S_e_e _A_l_s_o:

     'tsd', 'tseries', 'deccensus', 'decdiff', 'decmedian',  'decevf',
     'decreg', 'decloess'

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

     data(marbio)
     ClausoB.ts <- ts(log(marbio$ClausocalanusB + 1))
     ClausoB.dec <- decaverage(ClausoB.ts, order=2, times=10, sides=2, ends="fill")
     plot(ClausoB.dec, col=c(1, 3, 2), xlab="stations")
     # A stacked graph is more representative in this case
     plot(ClausoB.dec, col=c(1, 3), xlab="stations", stack=FALSE, resid=FALSE,
             lpos=c(53, 4.3))

