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


1) xdt=detrend(x,0)

2) xdt=detrend(x,1)

3) r0t = detrend(trimr(dx,grocer_k,0),f) (see johansen.sci)

 

Example 1 simply demeans x, example 2 detrends it by a linear trend, example 3 taken from the function johansen detrends variable trimr(dx,grocer_k,0) by a trend of order f. 



               

AUTHOR

Eric Dubois 2002