Learn R Programming

itsmr (version 1.10)

Resid: Compute residuals

Description

Compute residuals

Usage

Resid(x, M = NULL, a = NULL)

Value

Returns a vector of residuals the same length as x.

Arguments

x

Time series data

M

Data model

a

ARMA model

Details

The data model can be NULL for none. Otherwise M is a vector of function names and arguments.

Example:

M = c("log","season",12,"trend",1)

The above model takes the log of the data, then subtracts a seasonal component of period 12, then subtracts a linear trend component.

These are the available functions:

diffDifference the data. Has a single argument, the lag.
hrSubtract harmonic components. Has one or more arguments, each specifying the number of observations per harmonic.
logTake the log of the data, has no arguments.
seasonSubtract a seasonal component. Has a single argument, the number of observations per season.
trendSubtract a trend component. Has a single argument, the order of the trend (1 linear, 2 quadratic, etc.)

At the end of the model there is an implicit subtraction of the mean operation. Hence the resulting time series always has zero mean.

See Also

test

Examples

Run this code
M = c("log","season",12,"trend",1)
e = Resid(wine,M)

a = arma(e,1,1)
ee = Resid(wine,M,a)

Run the code above in your browser using DataLab