tsd                 package:pastecs                 R Documentation

_D_e_c_o_m_p_o_s_i_t_i_o_n _o_f _o_n_e _o_r _s_e_v_e_r_a_l _r_e_g_u_l_a_r _t_i_m_e _s_e_r_i_e_s _u_s_i_n_g _v_a_r_i_o_u_s _m_e_t_h_o_d_s

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

     Use a decomposition method to split the series into two or more
     components. Decomposition methods are either series
     filtering/smoothing (difference, average, median, evf),
     deseasoning (loess) or model-based decomposition (reg, i.e.,
     regression).

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

     tsd(x, specs=NULL, method="loess", type="additive", ...)
     ## S3 method for class 'tsd':
     summary(tsdobj)
     ## S3 method for class 'tsd':
     plot(tsdobj, series=1, stack=TRUE, resid=TRUE,
             labels, leg=TRUE, lpos=c(0, 0), ...)
     ## S3 method for class 'tsd':
     extract(tsdobj, n, series=NULL, components=NULL)
     ## S3 method for class 'tsd':
     specs(tsdobj)

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

       x: an univariate or multivariate regular time series ('rts' in
          Splus or 'ts' in R) to be decomposed 

   specs: specifications are collected from a 'tsd' object, using the
          'specs' method. This allows for reusing parameters issued
          from a previous similar analysis 

  method: the method to use to decompose the time series. Currently,
          possible values are: '"diff"', '"average"', '"median"',
          '"evf"', '"reg"', '"loess"' (by default) or '"census"'. The
          corresponding function 'decXXXX()' is applied to each of the
          series in 'x' 

    type: the type of model to use: either '"additive"' (by default) or
          '"multiplicative"'. In the additive model, all components
          must be added to reconstruct the initial series. In the
          multiplicative model, they must be multiplied (one components
          has the same unit as the original series, and the other ones
          are dimensionless multiplicative factors) 

     ...: (1) for 'tsd()': further arguments to pass to the
          corresponding 'decXXXX()' function. (2) for 'plot()': further
          graphical arguments 

  tsdobj: a 'tsd' object as returned by the function 'tsd()', or any of
          the 'decXXXX()' functions 

  series: (1) for 'plot()': the series to plot. By default, 'series=1',
          the first (or possibly unique) series in the 'tsd' object is
          plotted. (2) for 'extract': the name or the index of the
          series to extract. If 'series' is provided, then 'n' is
          ignored. By default, 'series=NULL'. It is also possible to
          use negative indices. In this case, all series are extracted,
          except those ones 

   stack: graphs of each component are either stacked ('stack=TRUE', by
          default), or superposed on the same graph 'stack=FALSE' 

   resid: do we have to plot also the "residuals" components
          ('resid=TRUE', by default) or not? Usually, in a stacked
          graph, you would like to plot the residuals, while in a
          superposed graph, you would not 

  labels: the labels to use for all y-axes in a stacked graph, or in
          the legend for a superposed graph. By default, the names of
          the components ("trend", "seasonal", "deseasoned",
          "filtered", "residuals", ...) are used 

     leg: only used when 'stack=FALSE'. Do we plot a legend ('leg=TRUE'
          or not? 

    lpos: position of the upper-left corner of the legend box in the
          graph coordinates (x,y). By default, 'leg=c(0,0)' 

       n: the number of series to extract (from series 1 to series n).
          By default, n equals the number of series in the 'tsd'
          object. If both 'series' and 'components' arguments are NULL,
          all series and components are extracted and this method has
          exactly the same effect as 'tseries' 

components: the names or indices of the components to extract. If
          'components=NULL' (by default), then all components of the
          selected series are extracted. It is also possible to specify
          negative indices. In this case, all components are extracted,
          except those ones 

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

     To eliminate trend from a series, use "diff" or use "loess" with
     'trend=TRUE'. If you know the shape of the trend (linear,
     exponential, periodic, etc.), you can also use it with the "reg"
     (regression) method. To eliminate or extract seasonal components,
     you can use "loess" if the seasonal component is additive, or
     "census" if it is multiplicative. You can also use "average" with
     argument 'order="periodic"' and with either an additive or a
     multiplicative model, although the later method is often less
     powerful than "loess" or "census". If you want to extract a
     seasonal cycle with a given shape (for instance, a sinusoid), use
     the "reg" method with a fitted sinusoidal equation. If you want to
     identify levels in the series, use the "median" method. To smooth
     the series, you can use preferably the "evf" (eigenvector
     filtering), or the "average" methods, but you can also use
     "median". To extract most important components from the series (no
     matter if they are cycles -seasonal or not-, or long-term trends),
     you should use the "evf" method. For more information on each of
     these methods, see online help of the corresponding 'decXXXX()'
     functions.

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

     An object of type 'tsd' is returned. It has methods 'print()',
     'summary()', 'plot()', 'extract()' and 'specs()'.

_N_o_t_e:

     If you have to decompose a single time series, you could also use
     the corresponding 'decXXXX()' function directly. In the case of a
     multivariate regular time series, 'tsd()' is more convenient
     because it decompose all times series of a set at once!

_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.

     Legendre, L. & P. Legendre, 1984. _Ecologie numrique. Tome 2: La
     structure des donnes cologiques._ Masson, Paris. 335 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:

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

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

     data(releve)
     # Regulate the series and extract them as a time series object
     rel.regy <- regul(releve$Day, releve[3:8], xmin=6, n=87, units="daystoyears",
             frequency=24, tol=2.2, methods="linear", datemin="21/03/1989",
             dateformat="d/m/Y")
     rel.ts <- tseries(rel.regy)

     # Decompose all series in the set with the "loess" method
     rel.dec <- tsd(rel.ts, method="loess", s.window=13, trend=FALSE)
     rel.dec
     plot(rel.dec, series=5, col=1:3)    # An plot series 5

     # Extract "deseasoned" components
     rel.des <- extract(rel.dec, series=3:6, components="deseasoned")
     rel.des[1:10,]

     # Further decompose these components with a moving average
     rel.des.dec <- tsd(rel.des, method="average", order=2, times=10)
     plot(rel.des.dec, series=3, col=c(2, 4, 6))
     # In this case, a superposed graph is more appropriate:
     plot(rel.des.dec, series=3, col=c(2,4), stack=FALSE, resid=FALSE,
             labels=c("without season cycle", "trend"), lpos=c(0, 55000))
     # Extract residuals from the latter decomposition
     rel.res2 <- extract(rel.des.dec, components="residuals")

