Estimate linear trend using inverse spectrum estimation, with the spectrum being computed via multitaper. This technique has improved spectral properties when compared to the least-squares approach. Returned values from this function include the intercept, slope, and centered time array.
multitaperTrend(xd, B, deltat, t.in)
Arguments
xd: Contiguous time series to be detrended.
B: Bandwidth to use in estimating trend in physical units; corresponds to NW via equation NW=BT, where N and W are the usual Slepian definitions, and T is the total time elapsed, i.e. T = N*deltat.
deltat: Time step for series xd, also used in computing T.
t.in: Time array, used in accurately estimating the slope.
Examples
x <-1:101y <-1.0+0.5*(x)+ rnorm(n=101,mean=0,sd=2)vars <- multitaperTrend(xd=y, B=0.05, deltat=1.0, t.in=x)plot(x,y,type="l")lines(x,vars[[1]]+vars[[2]]*vars[[3]],type="l",col="red")