On Tue, 2 Feb 2021, Sven Schreiber wrote:
Well, in a sense that's the classical example why the simple
algebraic
formulas shouldn't be directly applied in numerical computations. Given
floating-point representation the collinearity is not "so" exact that
the inverse-computing algorithm must fail. So it returns an inverse with
absurdly large numbers (check invpd(x'x)), and the whole thing is of
course numerically unstable, because we know that it isn't even
identified in theory.
So that's exactly why mols(), svd() and so forth exist; not only in
gretl, but in any numerical algebra software.
On top of this, you didn't try the coolest variant:
<hansl>
open greene19_1.gdt
# some series
series term1 = 0.3*TUCE + 4
series term2=2
list xlist = const TUCE term1 term2
matrix x = {xlist}
matrix y = {GPA}
# Model 1
ols GPA xlist --simple
b1 = $coeff
yh1 = {$yhat}
# Model 4
b4 = x\y
yh4 = x * b4
<hansl>
you may check that the fitted values are the same ;)
-------------------------------------------------------
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
-------------------------------------------------------