Estimate a BIMETS model object
(Note: this is the html version of the reference manual. Please consider reading the pdf version of this reference manual, wherein there are figures and the mathematical expressions are better formatted than in html.)
This function estimates equations that are linear in the coefficients, as specified in the behavioral equations of the input model object. Coefficients can be estimated for single equations or blocks of simultaneous equations. Coefficients restriction procedure derives from the theory of Lagrange Multipliers, while the Cochrane-Orcutt method allows to account for residuals autocorrelation.
The estimation function supports:
- Ordinary Least Squares;
- Instrumental Variables;
- Deterministic linear restrictions on the coefficients;
- Almon Polynomial Distributed Lags;
- Autocorrelation of the errors;
- Structural stability analysis (Chow tests);
Further details on estimation calculus can be found in MDL
help page; further details on Chow test can be found below in this section;
ESTIMATE(model=NULL, eqList=NULL, TSRANGE=NULL, forceTSRANGE=FALSE, estTech='OLS', IV=NULL, forceIV=FALSE, quietly=FALSE, showWarnings=FALSE, tol=.Machine$double.eps, digits=getOption('digits'), centerCOV=TRUE, CHOWTEST=FALSE, CHOWPAR=NULL, avoidCompliance=FALSE, ...)
model |
The BIMETS model object to be estimated (see also |
eqList |
The |
TSRANGE |
The time range of the estimation, as a four dimensional numerical array, |
forceTSRANGE |
If |
estTech |
The estimation technique used in the regression. Ordinary Least Squares |
IV |
The |
forceIV |
If |
quietly |
If |
showWarnings |
If |
tol |
The tolerance for detecting linear dependencies in the columns of a matrix while an inversion is requested. The default is |
digits |
Controls the number of digits to print when printing coefficients and statistics of the estimation. Valid values are 1 to 22 with a default of 7. |
centerCOV |
If |
CHOWTEST |
If |
CHOWPAR |
Indicates the last year-period where the stability test is performed. If |
avoidCompliance |
If |
... |
Backward compatibility. |
If outputText=TRUE
, for each behavioral in the eqList
this function will print out:
- the name of the estimated behavioral;
- the estimation technique used;
- the autocorrelation order of the error, if any, and the iterations count required to achieve the convergence;
- the estimated equation with calculated coefficients and regressor expression; for each coefficient the T-statistic and the significance will be printed out;
- the restriction equations imposed on the coefficients, if any;
- the F-test for the restrictions, including the PDL restrictions, if any;
- the final autocorrelation parameters for the error, along with their standard error, the T-statistic and the significance;
- the R-Squared and the Adjusted R-Squared;
- the Durbin-Watson Statistic;
- the Sum of squares of residuals;
- the Standard Error of Regression;
- the Log of the Likelihood Function;
- the F-statistic and the F-probability;
- the AIC and the BIC;
- the Mean of the Dependent Variable;
- the Number of Observations;
- the Number of Degrees of Freedom;
- the Current Sample, i.e. the TSRANGE
of estimation;
All probabilities lie between [0, 1].
For each behavioral in the eqList
this function will add 4 new named elements into the related behavioral of the output model object:
1) coefficients
: a numerical array built with the estimated coefficients;
2) errorCoefficients
: a numerical array built with the estimated coefficient for the error autoregression, if the ERROR>
structure has been provided in the model MDL
definition;
3) residuals
: the time series of the regression residuals. If an ERROR>
structure has been provided in the behavioral definition, the related residuals will be calculated as described in the Cochrane-Orcutt procedure (see MDL
).
3) residuals_no_error_correction
: if an ERROR>
structure has been provided in the behavioral definition, the residuals caclucated by using the original dependent and independent varibles are stored into this list element.
4) statistics
: a list built with the parameters and the statistics of the estimation, e.g.:
- TSRANGE
: TSRANGE requested in the latest estimation of the behavioral;
- estimationTechinque
: estimation technique requested in the latest estimation of the behavioral;
- CoeffCovariance
: coefficients covariance;
- StandardErrorRegression
and StandardErrorRegressionNotCentered
: standard error of the regression (centered and not-centered);
- CoeffTstatistic
: T-statistic of the coefficients;
- RSquared
: R-Squared;
- AdjustedRSquared
: adjusted R-Squared;
- DegreesOfFreedom
: degrees of freedom of the regression;
- CoeffPvalues
: coefficients p-values;
- LogLikelihood
: Log of the Likelihood Function;
- Fstatistics
: F-statistics;
- RhosTstatistics
: rhos T-statistic (if any);
- FtestRestrValue
: F-test value for the restrictions;
- FtestRestrProbability
: F-test probability for the restrictions;
- AIC
: Akaike's Information Criterion;
- BIC
: Schwarz's Information Criterion;
- matrixX
: the regressors matrix;
- vectorY
: the dependent variable;
- matrixX_error_corrected
: the regressors matrix arising from the Cochrane-Orcutt procedure;
- etc.
Structural Stability - Chow test
One of the main purposes of the econometric modeling is its use for forecast and policy evaluation and, to this end, the stability of a behavioral equation parameters over time should be verified. In order to check for structural stability two different procedures, which can be derived from the so called Chow-tests, are applied.
Given a sample of T_0 = t_k,...,t_n observations (i.e. the base TSRANGE
) and selecting an arbitrary forward extension in T_1 = t_k,...,t_n,...,t_m observations (i.e. the extended TSRANGE
) in the general case we have the following two regressions:
1) Y_0 = b_0*X_0+eps_0, eps_0 in N(0,sigma_0^2) , having time series projected on the base TSRANGE
2) Y_1 = b_1*X_1+eps_1, eps_1 in N(0,sigma_1^2) , having time series projected on the extended TSRANGE
In general a stability analysis is carried on in the following ways:
- comparing the parameter estimates arising from the two regressions: this is known as the covariance analysis;
- checking the accuracy of the forecast for the dependent variable in the extended TSRANGE
, using the estimates produced in the base TSRANGE
: this is known as the predictive power test.
The first Chow test is calculated as:
tau = ( SSR_1-SSR_0 ) / SSR_0 * DoF_1 / ( DoF_1-DoF_0 ) ,
with SSR_i as the sum of squared residuals and DoF_i as the number of degrees of fredoom in the regression i=0,1.
The test is completed by calculating the following time series on the extended TSRANGE
:
- the forecast error;
- the standard error of forecast;
- the t-statistic for the error;
The standard error of the forecast for the t_j observation in the extended TSRANGE
is computed according to:
SE_j = sigma_0 * sqrt(1+t(x_j) * ( t(X_0) * X_0)^(-1) * x_j)
having x_j as the independent values (i.e. regressors) on the t_j observation in the T_1 extended TSRANGE
, with n < j <= m.
The null hypothesis for tau is:
H* : beta_1 = beta_0, given sigma_1^2 = sigma_0^2
The test statistic tau follows the F distribution with ( DoF_1-DoF_0 ) and DoF_1 degrees of freedom, and can be performed during the ESTIMATE()
function execution by using the CHOWTEST
argument set to TRUE
.
If CHOWTEST
is TRUE
, for each behavioral in the eqList
the output model will have the following named element:
- ChowTest
: it contains the statistics and the time series computed during the last structural analysis performed on the related behavioral.
#define model myModelDefinition= "MODEL COMMENT> Modified Klein Model 1 of the U.S. Economy with PDL, COMMENT> autocorrelation on errors, restrictions and conditional evaluations COMMENT> Consumption BEHAVIORAL> cn TSRANGE 1925 1 1941 1 EQ> cn = a1 + a2*p + a3*TSLAG(p,1) + a4*(w1+w2) COEFF> a1 a2 a3 a4 ERROR> AUTO(2) COMMENT> Investment BEHAVIORAL> i TSRANGE 1923 1 1941 1 EQ> i = b1 + b2*p + b3*TSLAG(p,1) + b4*TSLAG(k,1) COEFF> b1 b2 b3 b4 RESTRICT> b2 + b3 = 1 COMMENT> Demand for Labor BEHAVIORAL> w1 TSRANGE 1925 1 1941 1 EQ> w1 = c1 + c2*(y+t-w2) + c3*TSLAG(y+t-w2,1) + c4*time COEFF> c1 c2 c3 c4 PDL> c3 1 3 COMMENT> Gross National Product IDENTITY> y EQ> y = cn + i + g - t COMMENT> Profits IDENTITY> p EQ> p = y - (w1+w2) COMMENT> Capital Stock with switches IDENTITY> k EQ> k = TSLAG(k,1) + i IF> i > 0 IDENTITY> k EQ> k = TSLAG(k,1) IF> i <= 0 END" #define model data myModelData=list( cn =TIMESERIES(39.8,41.9,45,49.2,50.6,52.6,55.1,56.2,57.3,57.8,55,50.9, 45.6,46.5,48.7,51.3,57.7,58.7,57.5,61.6,65,69.7, START=c(1920,1),FREQ=1), g =TIMESERIES(4.6,6.6,6.1,5.7,6.6,6.5,6.6,7.6,7.9,8.1,9.4,10.7,10.2,9.3,10, 10.5,10.3,11,13,14.4,15.4,22.3, START=c(1920,1),FREQ=1), i =TIMESERIES(2.7,-.2,1.9,5.2,3,5.1,5.6,4.2,3,5.1,1,-3.4,-6.2,-5.1,-3,-1.3, 2.1,2,-1.9,1.3,3.3,4.9, START=c(1920,1),FREQ=1), k =TIMESERIES(182.8,182.6,184.5,189.7,192.7,197.8,203.4,207.6,210.6,215.7, 216.7,213.3,207.1,202,199,197.7,199.8,201.8,199.9, 201.2,204.5,209.4, START=c(1920,1),FREQ=1), p =TIMESERIES(12.7,12.4,16.9,18.4,19.4,20.1,19.6,19.8,21.1,21.7,15.6,11.4, 7,11.2,12.3,14,17.6,17.3,15.3,19,21.1,23.5, START=c(1920,1),FREQ=1), w1 =TIMESERIES(28.8,25.5,29.3,34.1,33.9,35.4,37.4,37.9,39.2,41.3,37.9,34.5, 29,28.5,30.6,33.2,36.8,41,38.2,41.6,45,53.3, START=c(1920,1),FREQ=1), y =TIMESERIES(43.7,40.6,49.1,55.4,56.4,58.7,60.3,61.3,64,67,57.7,50.7,41.3, 45.3,48.9,53.3,61.8,65,61.2,68.4,74.1,85.3, START=c(1920,1),FREQ=1), t =TIMESERIES(3.4,7.7,3.9,4.7,3.8,5.5,7,6.7,4.2,4,7.7,7.5,8.3,5.4,6.8,7.2, 8.3,6.7,7.4,8.9,9.6,11.6, START=c(1920,1),FREQ=1), time =TIMESERIES(NA,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10, START=c(1920,1),FREQ=1), w2 =TIMESERIES(2.2,2.7,2.9,2.9,3.1,3.2,3.3,3.6,3.7,4,4.2,4.8,5.3,5.6,6,6.1, 7.4,6.7,7.7,7.8,8,8.5, START=c(1920,1),FREQ=1) ) #load model myModel=LOAD_MODEL(modelText=myModelDefinition) #load data into the model myModel=LOAD_MODEL_DATA(myModel,myModelData,showWarnings = TRUE) ################################################# #OLS case #estimate the model myModel=ESTIMATE(myModel) #HERE BELOW THE OUTPUT OF THE ESTIMATION (COMMENTED OUT): #.CHECK_MODEL_DATA(): warning, there are undefined values in time series "time". # #Estimate the Model myModelDefinition: #the number of behavioral equations to be estimated is 3. #The total number of coefficients is 14. # #_________________________________________ # #BEHAVIORAL EQUATION: cn #Estimation Technique: OLS #Autoregression of Order 2 (Cochrane-Orcutt procedure) # #Convergence was reached in 9 / 20 iterations. # # #cn = 19.01352 # T-stat. 12.13083 *** # # + 0.3442816 p # T-stat. 3.533253 ** # # + 0.03443117 TSLAG(p,1) # T-stat. 0.3937881 # # + 0.6993905 (w1+w2) # T-stat. 14.0808 *** # #ERROR STRUCTURE: AUTO(2) # #AUTOREGRESSIVE PARAMETERS: #Rho Std. Error T-stat. #0.05743131 0.3324101 0.1727725 # 0.007785936 0.2647013 0.02941404 # # #STATs: #R-Squared : 0.985263 #Adjusted R-Squared : 0.9785644 #Durbin-Watson Statistic : 1.966609 #Sum of squares of residuals : 9.273455 #Standard Error of Regression : 0.9181728 #Log of the Likelihood Function : -18.97047 #F-statistic : 147.0844 #F-probability : 1.090551e-09 #Akaike's IC : 51.94093 #Schwarz's IC : 57.77343 #Mean of Dependent Variable : 55.71765 #Number of Observations : 17 #Number of Degrees of Freedom : 11 #Current Sample (year-period) : 1925-1 / 1941-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # # #_________________________________________ # #BEHAVIORAL EQUATION: i #Estimation Technique: OLS # #i = 2.868104 # T-stat. 0.3265098 # # + 0.5787626 p # T-stat. 4.456542 *** # # + 0.4212374 TSLAG(p,1) # T-stat. 3.243579 ** # # - 0.09160307 TSLAG(k,1) # T-stat. -2.11748 # #RESTRICTIONS: #b2+b3=1 # #RESTRICTIONS F-TEST: #F-value : 8.194478 #F-prob(1,15) : 0.0118602 # # #STATs: #R-Squared : 0.8928283 #Adjusted R-Squared : 0.8794319 #Durbin-Watson Statistic : 1.173106 #Sum of squares of residuals : 26.76483 #Standard Error of Regression : 1.293368 #Log of the Likelihood Function : -30.215 #F-statistic : 66.64659 #F-probability : 1.740364e-08 #Akaike's IC : 68.43001 #Schwarz's IC : 72.20776 #Mean of Dependent Variable : 1.310526 #Number of Observations : 19 #Number of Degrees of Freedom : 16 #Current Sample (year-period) : 1923-1 / 1941-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # # #_________________________________________ # #BEHAVIORAL EQUATION: w1 #Estimation Technique: OLS # #w1 = 1.12869 # T-stat. 0.6479266 # # + 0.4398767 (y+t-w2) # T-stat. 12.01268 *** # # + c3 TSLAG(y+t-w2,1) # PDL # # + 0.1368206 time # T-stat. 3.373905 ** # #PDL: #c3 1 3 # #Distributed Lag Coefficient: c3 #Lag Coeff. Std. Error T-stat. #0 0.1076812 0.04283967 2.513586 * #1 0.05074557 0.01291231 3.930015 ** #2 -0.00619005 0.03110492 -0.1990055 #SUM 0.1522367 0.03873693 # #RESTRICTIONS F-TEST: #F-value : 0.06920179 #F-prob(1,11) : 0.7973647 # # #STATs: #R-Squared : 0.9890855 #Adjusted R-Squared : 0.9854474 #Durbin-Watson Statistic : 2.174168 #Sum of squares of residuals : 6.392707 #Standard Error of Regression : 0.7298805 #Log of the Likelihood Function : -15.80848 #F-statistic : 271.8645 #F-probability : 1.172284e-11 #Akaike's IC : 43.61697 #Schwarz's IC : 48.61625 #Mean of Dependent Variable : 37.69412 #Number of Observations : 17 #Number of Degrees of Freedom : 12 #Current Sample (year-period) : 1925-1 / 1941-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # #...ESTIMATE OK #get residuals of 'cn' myModel$behaviorals$cn$residuals #Time Series: #Start = 1925 #End = 1941 #Frequency = 1 # [1] -0.88562504 0.25109884 0.66750111 ... #[17] -1.41795908 #get residuals of 'i' myModel$behaviorals$i$residuals #Time Series: #Start = 1923 #End = 1941 #Frequency = 1 # [1] 1.464518775 -1.469763968 0.078674017 ... #[16] -2.425079127 -0.698071507 -1.352967430 -1.724306054 #get estimation coefficients of 'cn' and 'w1' myModel$behaviorals$cn$coefficients # [,1] #a1 19.01352476 #a2 0.34428157 #a3 0.03443117 #a4 0.69939052 myModel$behaviorals$cn$errorCoefficients # [,1] #RHO_1 0.057431312 #RHO_2 0.007785936 myModel$behaviorals$w1$coefficients # [,1] #c1 1.12869024 #c2 0.43987666 #c3 0.10768118 #c3_PDL_1 0.05074557 #c3_PDL_2 -0.00619005 #c4 0.13682057 ################################################# #IV case #estimation of Consumption "cn" with arbitrary IVs #and error autocorrelation myModel=ESTIMATE(myModel, eqList = 'cn', estTech = 'IV', IV=c('1', 'TSLAG(y)', 'TSLAG(w1)*pi+0.5', 'exp(w2)')) #Estimate the Model myModelDefinition: #the number of behavioral equations to be estimated is 1. #The total number of coefficients is 4. # #_________________________________________ # #BEHAVIORAL EQUATION: cn #Estimation Technique: IV #Autoregression of Order 2 (Cochrane-Orcutt procedure) # #Convergence was reached in 7 / 20 iterations. # # #cn = 18.07073 # T-stat. 11.72958 *** # # + 0.2530483 p # T-stat. 1.583881 # # + 0.08631646 TSLAG(p,1) # T-stat. 0.7556204 # # + 0.7363227 (w1+w2) # T-stat. 13.11572 *** # #ERROR STRUCTURE: AUTO(2) # #AUTOREGRESSIVE PARAMETERS: #Rho Std. Error T-stat. #0.01559806 0.343195 0.04544955 #-0.1196327 0.283432 -0.422086 # # #STATs: #R-Squared : 0.9843186 #Adjusted R-Squared : 0.9771907 #Durbin-Watson Statistic : 1.917329 #Sum of squares of residuals : 9.867739 #Standard Error of Regression : 0.9471363 #Log of the Likelihood Function : -19.49844 #F-statistic : 138.0938 #F-probability : 1.532807e-09 #Akaike's IC : 52.99689 #Schwarz's IC : 58.82938 #Mean of Dependent Variable : 55.71765 #Number of Observations : 17 #Number of Degrees of Freedom : 11 #Current Sample (year-period) : 1925-1 / 1941-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # #...ESTIMATE OK #define model myShortModelDefinition= "MODEL COMMENT> Consumption with IV BEHAVIORAL> cn TSRANGE 1925 1 1941 1 EQ> cn = a1 + a2*p + a3*TSLAG(p,1) + a4*(w1+w2) COEFF> a1 a2 a3 a4 IV> 1 IV> TSLAG(y) IV> TSLAG(w1)*pi+0.5 IV> exp(w2) END " #load model myShortModel=LOAD_MODEL(modelText=myShortModelDefinition) #load data into the model myShortModel=LOAD_MODEL_DATA(myShortModel,myModelData,showWarnings = TRUE) #estimation of Consumption "cn" with arbitrary IVs #and error autocorrelation myShortModel=ESTIMATE(myShortModel, eqList = 'cn', estTech = 'IV') #estimation of Investment "i" with arbitrary IVs #and coefficient restrictions myModel=ESTIMATE(myModel, eqList = 'i', estTech = 'IV', IV=c('1', 'TSLAG(w2)', 'TSLAG(w1)*pi+0.5', 'exp(w2)')) #.CHECK_MODEL_DATA(): warning, there are undefined values in time series "time". # #Estimate the Model myModelDefinition: #the number of behavioral equations to be estimated is 1. #The total number of coefficients is 4. # #_________________________________________ # #BEHAVIORAL EQUATION: i #Estimation Technique: IV # #i = 34.517544 # T-stat. 1.264388 # # + 0.3216326 p # T-stat. 0.8648297 # # + 0.6783672 TSLAG(p,1) # T-stat. 1.824043 # # - 0.2475568 TSLAG(k,1) # T-stat. -1.842520 # #RESTRICTIONS: #b2+b3=1 # #RESTRICTIONS F-TEST: #F-value : 2.465920 #F-prob(1,15) : 0.137190 # # #STATs: #R-Squared : 0.805773 #Adjusted R-Squared : 0.781494 #Durbin-Watson Statistic : 0.940534 #Sum of squares of residuals : 48.50580 #Standard Error of Regression : 1.741152 #Log of the Likelihood Function : -35.86365 #F-statistic : 33.18894 #F-probability : 2.025229e-06 #Akaike's IC : 79.72731 #Schwarz's IC : 83.50506 #Mean of Dependent Variable : 1.310526 #Number of Observations : 19 #Number of Degrees of Freedom : 16 #Current Sample (year-period) : 1923-1 / 1941-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # #...ESTIMATE OK ############################################################## #CHOW TEST on w1 #base TSRANGE set to 1925 / 1935 myModel=ESTIMATE(myModel, eqList='w1', TSRANGE=c(1925,1,1935,1), forceTSRANGE=TRUE, CHOWTEST=TRUE) #Estimate the Model myModelDefinition: #the number of behavioral equations to be estimated is 1. #The total number of coefficients is 6. # #_________________________________________ # #BEHAVIORAL EQUATION: w1 #Estimation Technique: OLS # #w1 = - 4.48873 # T-stat. -2.47402 * # # + 0.545102 (y+t-w2) # T-stat. 15.3462 *** # # + c3 TSLAG(y+t-w2,1) # PDL # # + 0.292018 time # T-stat. 5.58588 ** # #PDL: #c3 1 3 # #Distributed Lag Coefficient: c3 #Lag Coeff. Std. Error T-stat. #0 0.0413985 0.0336676 1.22963 #1 0.0493551 0.00742323 6.64873 *** #2 0.0573116 0.0265487 2.15873 #SUM 0.148065 0.0222697 # #RESTRICTIONS F-TEST: #F-value : 3.35954 #F-prob(1,5) : 0.126295 # # #STATs: #R-Squared : 0.995931 #Adjusted R-Squared : 0.993219 #Durbin-Watson Statistic : 2.43313 #Sum of squares of residuals : 0.737093 #Standard Error of Regression : 0.350498 #Log of the Likelihood Function : -0.742173 #F-statistic : 367.183 #F-probability : 2.68564e-07 #Akaike's IC : 13.4843 #Schwarz's IC : 15.8717 #Mean of Dependent Variable : 34.9909 #Number of Observations : 11 #Number of Degrees of Freedom : 6 #Current Sample (year-period) : 1925-1 / 1935-1 # # #Signif. codes: *** 0.001 ** 0.01 * 0.05 # # # #STABILITY ANALYSIS: #Behavioral equation: w1 # #Chow test: #Sample (auto) : 1936-1 / 1941-1 #F-value : 15.3457 #F-prob(6,12) : 5.34447e-05 # #Predictive Power: # #Date, Prd., Actual , Predict , Error , Std. Error , T-stat # #1936, 1 , 36.8 , 38.439 , -1.63901 , 0.547471 , -2.99378 #1937, 1 , 41 , 40.824 , 0.176033 , 0.630905 , 0.279017 #1938, 1 , 38.2 , 39.6553 , -1.4553 , 0.672192 , -2.165 #1939, 1 , 41.6 , 45.0547 , -3.45466 , 0.834433 , -4.14012 #1940, 1 , 45 , 49.0118 , -4.01179 , 0.966472 , -4.15096 #1941, 1 , 53.3 , 56.6727 , -3.37275 , 1.23486 , -2.73127 # # #...ESTIMATE OK
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.