Command Reference : Function Reference : Function Reference: D
  
 
@detrend
Compute deviations from the trend of a series.
Syntax: @detrend(x[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning result to a series
Return: series, vector, matrix
Returns the residuals of an OLS regression of the data versus an intercept and an implicit time trend.
For series calculations, EViews will use the current or specified workfile sample.
This function is panel aware.
Examples
The code below produces a graph of a series and its detrended form:
wfcreate m 2000 2020
series y = @trend + nrnd
group g y @detrend(y)
g.line
The first line creates a monthly workfile starting in January 2000 and ending in December 2020. The second line generates a series y equal to trend plus normal error. The last two lines graphs y and @detrend(y) together.
Cross-references
See also @demean.