Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

decloess

Time series decomposition by the LOESS method


Description

Compute a seasonal decomposition of a regular time series using a LOESS method (local polynomial regression)

Usage

decloess(x, type="additive", s.window=NULL, s.degree=0, t.window=NULL,
        t.degree=2, robust=FALSE, trend=FALSE)

Arguments

x

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

type

the type of model. This is for compatibility purpose. The only model type that is accepted for this method is type="additive". For a multiplicative model, use deccensus() instead

s.window

the width of the window used to extract the seasonal component. Use an odd value equal or just larger than the number of annual values (frequency of the time series). Use another value to extract other cycles (circadian, lunar,...). Using s.window="periodic" ensures a correct value for extracting a seasonal component when the time scale is in years units

s.degree

the order of the polynome to use to extract the seasonal component (0 or 1). By default s.degree=0

t.window

the width of the window to use to extract the general trend when trend=TRUE (indicate an odd value). If this parameter is not provided, a reasonable value is first calculated, and then used by the algorithm.

t.degree

the order of the polynome to use to extract the general trend (0, 1 or 2). By default t.degree=2

robust

if TRUE a robust regression method is used. Otherwise (FALSE), by default, a classical least-square regression is used

trend

If TRUE a trend is calculated (under R only). Otherwise, the series is decomposed into a seasonal component and residuals only

Details

This function uses the stl() function for the decomposition. It is a wrapper that create a 'tsd' object

Value

a 'tsd' object

Author(s)

Philippe Grosjean (phgrosjean@sciviews.org), Frédéric Ibanez (ibanez@obs-vlfr.fr)

References

Cleveland, W.S., E. Grosse & W.M. Shyu, 1992. Local regression models. Chapter 8 of Statistical Models in S. J.M. Chambers & T.J. Hastie (eds). Wadsworth & Brook/Cole.

Cleveland, R.B., W.S. Cleveland, J.E. McRae, & I. Terpenning, 1990. STL: A seasonal-trend decomposition procedure based on loess. J. Official Stat., 6:3-73.

See Also

Examples

data(releve)
melo.regy <- regul(releve$Day, releve$Melosul, xmin=9, n=87,
        units="daystoyears", frequency=24, tol=2.2, methods="linear",
        datemin="21/03/1989", dateformat="d/m/Y")
melo.ts <- tseries(melo.regy)
melo.dec <- decloess(melo.ts, s.window="periodic")
plot(melo.dec, col=1:3)

pastecs

Package for Analysis of Space-Time Ecological Series

v1.3.21
GPL-2
Authors
Philippe Grosjean [aut, cre], Frederic Ibanez [aut], Michele Etienne [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.