Learn R Programming

itsmr (version 1.9)

trend: Estimate trend component

Description

Estimate trend component

Usage

trend(x, p)

Value

Returns a vector the same length as x. Subtract from x to obtain residuals. The returned vector is the least squares fit of a polynomial to the data.

Arguments

x

Time series data

p

Polynomial order (1 linear, 2 quadratic, etc.)

See Also

season

Examples

Run this code
y = trend(uspop,2)
plotc(uspop,y)

Run the code above in your browser using DataLab