Name

ols — ordinary least squares

CALLING SEQUENCE

[rols]=ols(namey,arg1,…,argn)

PARAMETERS

Input

• namey = a time series, a real (nx1) vector or a string equal to the name of a time series or a (nx1) real vector between quotes

• argi = arguments which can be:

 - a time series

 - a real (nx1) vector

 - a real (nxk) matrix

 - a string equal to the name of a time series or a (nxk) real vector or matrix between quotes

 - a list of such elemnts

 - the string 'noprint' if the user doesn't want to display the results of the regression

Output

• rols = a results tlist with

  - rols('meth') = 'ols'

  - rols('y') = y data vector

  - rols('x') = x data matrix

  - rols('nobs') = # observations

  - rols('nvar') = # variables

  - rols('beta') = bhat

  - rols('yhat') = yhat

  - rols('resid') = residuals

  - rols('vcovar') = estimated variance-covariance matrix of beta

  - rols('sige') = estimated variance of the residuals

  - rols('sigu') = sum of squared residuals

  - rols('ser') = standard error of the regression

  - rols('tstat') = t-stats

  - rols('pvalue') = pvalue of the betas

  - rols('dw') = Durbin-Watson Statistic

  - rols('condindex') = multicolinearity cond index

  - rols('prescte') = boolean indicating the presence or absence of a constant in the regression

  - rols('rsqr') = rsquared

  - rols('rbar') = rbar-squared

  - rols('f') = F-stat for the nullity of coefficients other than the constant

  - rols('pvaluef') = its significance level

  - rols('prests') = boolean indicating the presence or absence of a time series in the regression

  - rols('namey') = name of the y variable

  - rols('namex') = name of the x variables

  - rols('bounds') = if there is a timeseries in the regression, the bounds of the regression

DESCRIPTION

The most general GROCER function performing least-squares regression. Endogenous variable must be given first, as a vector, a ts, between quotes (if the user wants to keep the name of the variable in the tlist result and for the printings) or not. Exogenous variables are given after, in one of the formats authorized for the endogenous one, or in matrix format. The program displays on screen various results (coefficients, tstat, Rª, Durbin and Watson,…) except if the user has entered the argument 'noprint' anywhere after the first argument.

EXAMPLE


load(GROCERDIR+'data/bdhenderic.dat');
bounds('1964q3','1989q2');
rols=ols('delts(lm1-lp)','delts(lp)','delts(lagts(1,lm1-lp-ly))','rnet', 'lagts(1,lm1-lp-ly)', 'const');
//performs ols for Hendry and Ericsson (1991) equation n° 6 

rols=ols('delts(lm1-lp)',['delts(lp)','delts(lagts(1,lm1-lp-ly))','rnet', 'lagts(1,lm1-lp-ly)','const']);
//same results as previous call to ols

rols=ols(delts(lm1-lp),delts(lp),delts(lagts(1,lm1-lp-ly)),rnet, lagts(1,lm1-lp-ly),const);
//same results as 2 previous calls to ols, except that the third example does not keep the names of the variables, which are named 'endogenous', 'exogenous # 1', 'exogenous # 2', 'exogenous # 3', 'exogenous # 4', 'exogenous # 5'. 

rols=ols(delts(lm1-lp),delts(lp),delts(lagts(1,lm1-lp-ly)),rnet, lagts(1,lm1-lp-ly),const, 'noprint');
//same results as 2 first calls to ols, except that the results are not displayed on screen (this can be done later by typing prtuniv(rols)).

y=grand(100,1, 'nor',0,1);
x=grand(100,4, 'nor',0,1);
ols('y', 'x')

ols(y, x);
// same results as above, except that the endogenous variables 'endogenous' instead of y and the exogenous variables 'exogenous # 1', 'exogenous # 2', 'exogenous # 3', 'exogenous # 4' instead of 'x_1', 'x_2', 'x_3', 'x_4'.

               

AUTHOR

Eric Dubois 2002