Friday, July 18, 2008

LS Solver

The log of the LS solver as distributed in 22.8 beta is slightly different from the original version I compiled myself.

Gams version based on my donated sources:

=============================================================
Least Squares Solver
=============================================================

Parameter Estimate Std. Error t value Pr(>|t|)
b( const) -3.48226E+06 8.90420E+05 -3.91080E+00 3.56040E-03 **
b( gnpdefl) 1.50619E+01 8.49149E+01 1.77376E-01 8.63140E-01
b( gnp) -3.58192E-02 3.34910E-02 -1.06952E+00 3.12681E-01
b( unempl) -2.02023E+00 4.88400E-01 -4.13643E+00 2.53509E-03 **
b( army) -1.03323E+00 2.14274E-01 -4.82199E+00 9.44367E-04 ***
b( pop) -5.11041E-02 2.26073E-01 -2.26051E-01 8.26212E-01
b( year) 1.82915E+03 4.55478E+02 4.01589E+00 3.03680E-03 **
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Estimation statistics:
Cases: 16 Parameters: 7 Residual sum of squares: 8.36424E+05
Residual standard error: 3.04854E+02 on 9 degrees of freedom
Multiple R-squared: 9.95479E-01 Adjusted R-squared: 9.92465E-01
F statistic: 3.30285E+02 on 6 and 9 DF, p-value: 4.98403E-10

GDX library version: GDX Library BETA 14Jul08 22.8.0 WIN 5737.5744 VIS x86
/MS Windows
GDX file: ls.gdx


My original version:

=======================================================================
Least Square Solver V2
Erwin Kalvelagen, Amsterdam Optimization Modeling Group
www.amsterdamoptimization.com
=======================================================================

Parameter Estimate Std. Error t value Pr(>|t|)
b('const') -3.48226E+06 8.90420E+05 -3.91080E+00 3.56040E-03 **
b('gnpdefl') 1.50619E+01 8.49149E+01 1.77376E-01 8.63141E-01
b('gnp') -3.58192E-02 3.34910E-02 -1.06952E+00 3.12681E-01
b('unempl') -2.02023E+00 4.88400E-01 -4.13643E+00 2.53509E-03 **
b('army') -1.03323E+00 2.14274E-01 -4.82199E+00 9.44367E-04 ***
b('pop') -5.11041E-02 2.26073E-01 -2.26051E-01 8.26212E-01
b('year') 1.82915E+03 4.55478E+02 4.01589E+00 3.03680E-03 **
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Estimation statistics:
Cases: 16 Parameters: 7 Residual sum of squares: 8.36424E+05
Residual standard error: 3.04854E+02 on 9 degrees of freedom
Multiple R-squared: 9.95479E-01 Adjusted R-squared: 9.92465E-01
F statistic: 3.30285E+02 on 6 and 9 DF, p-value: 4.98403E-10

DLL version: _GAMS_GDX_237_2007-01-09
GDX file: ls.gdx



The labels seem to have lost their quotation marks. I hoped my code was easily portable, but this may indicate a weakness (although I don't see immediately what I did wrong here). Most importantly the numerical results are the same, so that is good. Actually my banner has "least square" which should read "least squares" (surely in most cases we have multiple squared errors).