I thought we had a sign function in gretl but I cannot find it
(returning 1 if positive -1 if negative, 0 if zero)
The need arose in estimating AR(1) procecess with a near-unit root.
Following Hamilton's advise in order to avoid crashing the iterative
algorithm, I reparametrize the autoregressive coefficient rho by
rho = lambda / (1 + abs(lambda)
Then
lambda = rho / (1- sgn{rho} *rho).
Certainly one can write
sign(rho) = (1- (rho==0) )* (1- 2*(rho <0)),
or something more efficient,
but the sign seems pretty fundamental to be an expression or a
user-defined function. Is it hidden somewhere? :)
--
Alecos Papadopoulos PhD
Athens University of Economics and Business
web:
alecospapadopoulos.wordpress.com/
skype:alecos.papadopoulos