Command Reference : Matrix Language Reference
Intercept from trend regression.
Syntax: @intercept(m)
m: matrix, vector
Return: number
Returns the intercept 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.
We 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 intercept estimate is given by
scalar icpt1 = @intercept(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 coefficients, so
scalar icpt2 = vcoefs(1)
is the intercept.
Estimates may also be obtained using the series and an equation object
equation y c @trend
scalar icpt3 = eq1.c(1)
See also @trendcoef, @cintercept, and @ctrendcoef.