[Gretl-devel] Improvements in the user-defined function packages

Allin Cottrell cottrell at wfu.edu
Thu Oct 18 11:13:45 EDT 2007


On Thu, 18 Oct 2007, andreas.rosenblad at ltv.se wrote:

> Currently, when writing a user-defined function, the parameters 
> can be of six types: bool (scalar variable acting as a Boolean 
> switch), int (scalar variable acting as an integer), scalar 
> (scalar variable), series (data series), list (named list of 
> series) and matrix (named matrix or vector).
> 
> To make it easier to write a user-defined function and make it 
> more flexible I would appreciate if three other parameter types 
> could be included:
> 
> * "discrete" (a data series with only discrete values)
> * "proportion" or "quantile" (a scalar which value is between 0 and 1)
> * "select" (providing a list of alternatives to select from).
> 
> As it is now, the first two parameter types, "discrete" and 
> "proportion", could be input to the function as "series" and 
> "scalar", and the user has to let the function check if they are 
> discrete or between 0 and 1. It would be nice if it instead was 
> automatically checked already at the input by the parameter type 
> chosen.

"proportion" would be quite easy to do; "discrete" less so.  The 
trouble is that I don't think "discrete" denotes a well-defined 
data type.  It would, I suppose, if we restricted it to integer 
values, but some people think that's too restrictive. As things 
stand, I think it's up to the function writer to decide what 
counts as discrete in any given context.

> For the third parameter type, "select", I imagine writing e.g. 
> function(select rejectionregion["two sided","one sided 
> lower","one sided upper"]) would in the GUI produce a drop-down 
> list for this parameter

That's definitely a nice idea.  We could have a go at that after 
the 1.6.6 release.

Allin.


More information about the Gretl-devel mailing list