This function is a simple wrapper to the decompose
function. The decompose
function separates a time series into additive or multiplicative components describing a trend, cyclical variation (e.g., daily or annual), and the remainder. The additive decomposition assumes that the cyclical component of the time series is stationary (i.e., the variance is constant), whereas a multiplicative decomposition accounts for non-stationarity. By default, a moving average with a symmetric window is used to filter the cyclical component. Alternatively, a vector of filter coefficients in reverse time order can be supplied (see decompose
).
The decompose
function requires a ts object with a specified frequency. The decomp
function converts the input swmpr vector to a ts object prior to decompose
. This requires an explicit input defining the frequency in the time series required to complete a full period of the parameter. For example, the frequency of a parameter with diurnal periodicity would be 96 if the time step is 15 minutes (24 hours * 60 minutes / 15 minutes). The frequency of a parameter with annual periodicity at a 15 minute time step would be 35040 (365 days * 24 hours * 60 minutes / 15 minutes). For simplicity, chr strings of 'daily'
or 'annual'
can be supplied in place of numeric values. A starting value of the time series must be supplied in the latter case. Use of the setstep
function is required to standardize the time step prior to decomposition.
Note that the decompose
function is a relatively simple approach and alternative methods should be investigated if a more sophisticated decomposition is desired.