Grocer Function
NAME
ptrend - matrix of polynomial trend
CALLING SEQUENCE
[xmat]=ptrend(p,nobs)
PARAMETERS
Input
-
p = order of the time-trend polynomial
. p < 0, xmat = empty vector
. p = 1, xmat = time trend
. p > 1, xmat = higher order polynomial in time
-
nobs = size of the matrix
Output
- xmat = matrix containing polynomial trend model data set
DESCRIPTION
Produces an explanatory variables matrix containing a polynomial time-trend
EXAMPLE
1) ext=ptrend(2,10)
2) r=ols1(y,ptrend(t,nobs))
Example 1 gives the matrix:
! 1. 1. 1. !
! 1. 2. 4. !
! 1. 3. 9. !
! 1. 4. 16. !
! 1. 5. 25. !
! 1. 6. 36. !
! 1. 7. 49. !
! 1. 8. 64. !
! 1. 9. 81. !
! 1. 10. 100. !
In example 2 (taken from kpss) ptrend calculates the matrix of trends corresponding to the choice of the user for t and the # of observations nobs of the variable y and enter them in the function ols1.
AUTHOR
Eric Dubois 2002