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(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------