El 05/05/11 05:16, Allin Cottrell escribió:
On Wed, 4 May 2011, Qi Shi wrote:
> There are three variables y,x.and z in my data, in which z is a
> dummy. I would like to define a new variable w: if z=1, w=y;
> otherwise w=-infinity. What is the scripts? thanks!
In principle,
w = (z==1)? y : -1/0
However, you can't actually represent infinities in gretl: the
expression "-1/0" will produce a missing value (NA).
According to the gretl users guide, gretl uses "double-precision
floating-point numbers", and looking at wikipedia, if I am not
understanding badly, it seems that the maximum number we may use is
1.7976931348623157 E+308 (Max Double)
I see in the gretl console that with negative sign, the minimum number
that gretl accepts is -1.7976931348623156e+308 so the better
approximation to what you want in gretl would be:
w = (z==1)? y : -1.7976931348623156e+308
#### some gretl results:
scalar x=-1.7976931348623157e+308
Se ha reemplazado el escalar x = NA
? scalar x=-1.7976931348623156e+308
Se ha reemplazado el escalar x = -1.79769e+308
--
Ignacio Diaz-Emparanza
DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA)
UPV/EHU Avda. Lehendakari Aguirre, 83 | 48015 BILBAO
T.: +34 946013732 | F.: +34 946013754
www.ea3.ehu.es