Ordinary Least Squares (OLS)
- 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 iName of set of observations i(*).pName of set of estimates p(*).AName of two-dimensional explanatory variable matrix A(i,p).yName of one-dimensional dependent variable y(i).estName of one-dimensional estimated statistical coefficients est(p).
The following names parameters are available:
Parameter Description covar=idStatistical info: variance-covariance matrix CoVar(p,p)df=idStatistical info: degrees of freedom (scalar)fitted=idStatistical info: fitted values for dependent variable fitted(i)r2=idStatistical info: R squared (scalar)resid=idStatistical info: residuals resid(i)resvar=idStatistical info: residual variance (scalar)rss=idStatistical info: residual sum of squares (scalar)se=idStatistical info: standard errors se(p)sigma=idStatistical info: standard error (scalar)tval=idStatistical info: standard errors se(p)gdxIn=fileIn.gdxName of GDX file that contains symbols i,p,A, andy. Mandatory if called from the command line, otherwise optional.gdxOut=fileOut.gdxName of GDX file that contains symbol estand 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.