[Gretl-devel] Bugs, missing features and a suggestion

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Thu Sep 27 03:33:52 EDT 2007


On Tue, 25 Sep 2007, andreas.rosenblad at ltv.se wrote:

> 5. Create a new boolean command isdiscrete() to check if a series or matrix
> contains only discrete values, with outputs 1 if it is discrete and 0
> otherwise.
>
> Fourth, I have a suggestion and possibly feature request: To check that a
> variable is discrete, accoriding to the User's Guide gretl currently checks
> that all values are integer multiples of 0.25 and that the variable takes
> on a “fairly small” set of distinct values, where “fairly small” is defined
> as less than or equal to 8. Would it possible to use a more exact method?
> For example, I use
>
> if sum(foo-int(foo))=0
>      discrete foo
> endif

The condition on which a variable should be considered discrete is an 
issue that has popped up several times, and I think that in the end there 
is no answer that is always right: ultimately, it depends on the context.

For example, in some settings I'd be more willing to consider as discrete 
a variable which contains the 3 possible values {0, 0.123456, 1} than one 
containing all possible non-negative integers.

A possible solution is that the user writes his/her own function to 
determine if a variable should be treated as discrete, uses said function 
to MARK the variable as such via the discrete command and from that point 
on relies on the "discrete" flag. Note that some generated variables are 
flagged discrete by construction, such as those produced by the "dummify" 
command.

A patch is attached, which defines the isdiscrete() user-level function. 
In accordance with the above, no calculations are made: the function just 
returns 1 if the variable has been marked as discrete by the user. I 
haven't committed this to CVS as I'm not sure if there's consensus on the 
above.


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti at univpm.it
http://www.econ.univpm.it/lucchetti
-------------- next part --------------
A non-text attachment was scrubbed...
Name: isdiscrete.diff
Type: text/x-diff
Size: 6144 bytes
Desc: 
Url : http://lists.wfu.edu/pipermail/gretl-devel/attachments/20070927/c8d9008c/isdiscrete.bin


More information about the Gretl-devel mailing list