Skip to contents

Removes the least squares straight line, leaving \(x_i - (a + b t_i)\). t defaults to 0, 1, 2, ..., which is right only for evenly spaced observations.

Usage

Detrnd(x, t = NULL)

Arguments

x

Series.

t

Optional times; 0..n-1 by default.

Value

Named list with estimate (the slope), detrended, fitted, intercept, slope, n, method.

References

Standard preprocessing; no single owning source.

Examples

Detrnd(c(1, 3.1, 5, 7.2, 9.1))
#> $estimate
#> [1] 2.03
#> 
#> $detrended
#> [1] -0.02  0.05 -0.08  0.09 -0.04
#> 
#> $fitted
#> [1] 1.02 3.05 5.08 7.11 9.14
#> 
#> $intercept
#> [1] 1.02
#> 
#> $slope
#> [1] 2.03
#> 
#> $n
#> [1] 5
#> 
#> $method
#> [1] "linear detrending by least squares"
#>