Name
detrend — detrend a matrix
CALLING SEQUENCE
[resid]=detrend(y,p)
PARAMETERS
- Input
y = input matrix (or vector) of time-series (nobs x nvar)
p = trend degree
* p = 0, subtracts mean
* p = 1, constant plus trend model
* p > 1, higher order polynomial model
* p = -1, returns y
- Output
resid = residuals from the detrending regression
DESCRIPTION
Detrends a matrix y using regression of y against a polynomial time trend of order p
EXAMPLE
x=grand(15,1,'nor',0,0.1)+[1:15]'
xdt=detrend(x,0)
// simply demeans x
xdt=detrend(x,1)
// detrends it by a linear trend
r0t = detrend(trimr(dx,grocer_k,0),f) (see johansen.sci)
// taken from the function johansen detrends variable trimr(dx,grocer_k,0) by a trend of order f.