At 00:33 15/07/2008, you wrote:
I agree the extension you propose would be nice. However, the
underlying
machinery which deals with the dollar accessors doesn't lend itself to
accommodate it easily. Maybe using pointers is easier. Here's a small
proof-of-concept script:
<script>
function reverse_ols(series y, list X, matrix *rcoeff, series *rres)
ols y X --quiet
rcoeff = -$coeff
rres = -$uhat
end function
open data4-1
list reg = const sqft bedrms baths
ols price reg
u = $uhat
matrix foo
series bar
reverse_ols(price, reg, &foo, &bar)
print u bar -o
</script>
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti
The difficulty with the use of pointers rather
than $ accessors is really one of how to provide
a single package which implements the basic
procedure for the novice user while giving the
expert user the ability to recover additional
results. By adding the requirement to define
additional variables and provide the relevant
pointers the function becomes less easy to use
for someone who just wants to run a simple
estimation and has no requirement for anything
beyond the basic printed output. Still, it may
be the case that my goal is not achievable with
the way in which functions and function packages work.
As an alternative, I am inclined to provide two
versions of each function package - one for
novice users with no results being returned, and
the other for those who want to get access to
coefficients, etc. Both would be little more
than different front-ends to the same basic
procedures but with alternative sets of options
and information returned. It might be helpful if
there were some default conventions which would
allow a number of function packages to follow
broadly the same approach and naming protocols.
At the same time, it would be nice to be able to
use the $ accessors for compatibility with normal gretl commands.
Gordon Hughes