Thanks guys. This solves it, and the $hat accessor idea is also nice.

For the moment I used "method 3" as appears in gretl's user guide Cheat Sheet (ch. 21) "Generating the “hat” values after an OLS regression".

Alecos Papadopoulos PhD
Athens University of Economics and Business
web: alecospapadopoulos.wordpress.com/
scholar:https://g.co/kgs/BqH2YU
On 15/3/2021 16:31, Riccardo (Jack) Lucchetti wrote:
On Mon, 15 Mar 2021, Allin Cottrell wrote:

I can see that the "ensure unique names" facility is not helpful in this context. In git and snapshots there's now an --overwrite option for the leverage command. The effect is that the same default names will be reused on each iteration.

There may be a few other commands that could benefit from such an option for use within a loop.

Thanks, Allin.

Another (possibly complementary) way to solve the problem would be introducing a new accessor ($hat, maybe?) that gives you the series with the diagonal of the projection matrix, that is

<hansl>
set verbose off
open data4-1.gdt
list X = const sqft
ols price X

series hat = NA
mX = {X}
matrix iXX = invpd(mX'mX)
loop i = 1 .. $nobs
    hat[i] = qform(mX[i,], iXX)
endloop

print hat -o
</hansl>

Once you've got those, all the rest follows.

-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/