Command Reference : Function Reference : Function Reference: T
  
 
@trendcoef
 
Trend coefficient from detrending regression.
Computes the trend coefficient (or coefficients for panel data) of an OLS regression versus a constant and an implicit time trend.
Syntax: @trendcoef(x[, s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigning to series
Return: number
Returns the trend coefficient of an OLS regression on matrix or vector m versus a constant and an implicit time trend, as in @detrend.
When applied to a matrix, the matrix elements are arranged in vectorization order and then paired with the implicit time trend.
This function is panel aware.
For series calculations, EViews will use the current or specified workfile sample.
Examples
series y = 2 + 3 * @trend + @nrnd
= @trendcoef(y)
The first line generates the series y using a simple linear regression model, where the sole regressor is a time trend, the intercept is 2, and the slope coefficient is 3. The second line returns the OLS estimate of the slope coefficient, and is approximately 3 in large samples.
The following commands begin by creating a workfile, generating a random series, and then converting to a vector so that we can compute identical results using the series and the vector.
workfile u 100
series y = nrnd
vector yv = @convert(y)
The trend regression trend coefficient estimate is given by
scalar tr1 = @trendcoef(yv)
Alternately, the trend regression results may be obtained using the vector YV using the @regress command on the augmented data matrix:
matrix vcoefs = @regress(@hcat(yv, @ones(yv.@rows), @range(0, yv.@rows-1)))
The first column of VCOEFS contains the intercept and trend coefficient, so
scalar tr2 = vcoefs(2)
is the trend coefficient.
Estimates may also be obtained using the series and an equation object
equation eq1.ls y c @trend
scalar tr3 = eq1.c(2)
Cross-references
See also @cintercept, @ctrendcoef, and @intercept.