Ordinary Least Squares (OLS)

Table of Contents

Note
This tool is part of the GAMS Tools Library. Please inspect the general information about GAMS Tools.

This estimates the unknown parameters in a linear regression model. The set i are the observations, the set p are the estimates. The matrix A(i,p) contains the explanatory variable and y(i) the dependent variable. On return the symbol estimate(p) will contain the estimated statistical coefficients. Other statistical information parameters are available.

Usage

Command line:

gamstool [linalg.]OLS i p A y est [covar=id] [df=id] [fitted=id] [r2=id] [resid=id] [resvar=id] [rss=id] [se=id] [sigma=id] [tval=id]  gdxIn=fileIn.gdx gdxOut=fileOut.gdx

Compile time:

$callTool [linalg.]OLS i p A y est [covar=id] [df=id] [fitted=id] [r2=id] [resid=id] [resvar=id] [rss=id] [se=id] [sigma=id] [tval=id]  [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]

Execution time:

executeTool '[linalg.]OLS i p A y est [covar=id] [df=id] [fitted=id] [r2=id] [resid=id] [resvar=id] [rss=id] [se=id] [sigma=id] [tval=id]  [gdxIn=fileIn.gdx] [gdxOut=fileOut.gdx]';

Where:

Argument Description
i Name of set of observations i(*).
p Name of set of estimates p(*).
A Name of two-dimensional explanatory variable matrix A(i,p).
y Name of one-dimensional dependent variable y(i).
est Name of one-dimensional estimated statistical coefficients est(p).

The following names parameters are available:

Parameter Description
covar=id Statistical info: variance-covariance matrix CoVar(p,p)
df=id Statistical info: degrees of freedom (scalar)
fitted=id Statistical info: fitted values for dependent variable fitted(i)
r2=id Statistical info: R squared (scalar)
resid=id Statistical info: residuals resid(i)
resvar=id Statistical info: residual variance (scalar)
rss=id Statistical info: residual sum of squares (scalar)
se=id Statistical info: standard errors se(p)
sigma=id Statistical info: standard error (scalar)
tval=id Statistical info: standard errors se(p)
gdxIn=fileIn.gdx Name of GDX file that contains symbols i, p, A, and y. Mandatory if called from the command line, otherwise optional.
gdxOut=fileOut.gdx Name of GDX file that contains symbol est and statistical information parameters after execution. Mandatory if called from the command line, otherwise optional.

Example

For an example see model [LeastSquares] in the GAMS Data Utilities Library.