Using gret l for Principles of Econometrics, 4th Edition
The Structural Equations
The structural equations are estimated using two-stage least squares. The basic gretl commands for this estimator are discussed in Chapter 10. The instruments consist of all exogenous variables, i. e., the same variables you use to estimate the reduced form equations (11.3) and (11.4).
1 open "@gretldirdatapoetruffles. gdt"
2 list z = const ps di pf
3 tsls q const p ps di; z
4 tsls q const p pf; z
The second line of the script estimates puts all of the exogenous variables into a list called z. These variables are the ones used to compute the first-stage regression, i. e., the list of instruments. Line 3 estimates the coefficients of the demand equation by TSLS. The gretl command tsls calls for the two-stage least squares estimator and it is followed by the structural equation you wish to estimate. List the dependent variable (q) first, followed by the regressors (const p ps di). A semicolon separates the model to be estimated from the list of instruments, now contained in the list, z. The fourth line uses the same format to estimate the parameters of the supply equation. Refer to section 10.2, and Figures 10.1 and 10.2 specifically, about using the GUI to estimate the model.
The results from two-stage least squares estimation of the demand equation appear below in Table 11.2 The coefficient on price in the demand equation is -0.374 and it is significantly negative at 5% level. It is good to know that demand curves have a negative slope! The Hausman test for the exogeneity of price is equal to 132 with a near 0 p-value. Price is clearly not exogenous. The test for weak instruments exceeds 10. Additional information from the results yields
Critical values for desired TSLS maximal size, when running tests at a nominal 5% significance level:
size 10% 15% 20% 25%
value 16.38 8.96 6.66 5.53
Maximal size is probably less than 10%
Clearly, the set of instruments is fairly strong. There is no Sargan test because the model is not overidentified. With one endogenous variable there is only 1 external instrument provided by pf from the supply equation.
The results for the supply equation are in Table 11.3 In this case, the coefficient on price is positive (as expected). The model is suitably overidentified according to the Sargan test (p - value=0.216 > 0.05), and the instruments are suitably strong (First-stage F-statistic (2, 26) = 41.4873). The outcome of the Hausman test looks suspicious. The statistic is close to zero. A manual check can easily be done using the script:
TSLS of Demand, using observations 1-30
Dependent variable: q
Instrumented: p
Instruments: const ps di pf
Coefficient |
Std. Error |
z |
p-value |
|
const |
-4.27947 |
5.54388 |
-0.7719 |
0.4402 |
ps |
1.29603 |
0.355193 |
3.6488 |
0.0003 |
di |
5.01398 |
2.28356 |
2.1957 |
0.0281 |
p |
-0.374459 |
0.164752 |
-2.2729 |
0.0230 |
Mean dependent var |
18.45833 |
S. D. dependent var |
4.613088 |
Sum squared resid |
631.9171 |
S. E. of regression |
4.929960 |
R2 |
0.226805 |
Adjusted R2 |
0.137590 |
F(3, 26) |
5.902645 |
P-value(F) |
0.003266 |
Log-likelihood |
-193.8065 |
Akaike criterion |
395.6130 |
Schwarz criterion |
401.2178 |
Hannan-Quinn |
397.4061 |
Hausman test -
Null hypothesis: OLS estimates are consistent Asymptotic test statistic: x2(1) = 132.484 with p-value = 1.17244e-030
Weak instrument test -
First-stage F(1,26) = 20.5717
Table 11.2: Two-stage least square estimates of the demand of truffles.
1 ols p x
2 series v = $uhat
3 ols q const p pf v
4 omit v
The first step is to regress all instruments on the endogenous regressor, p. Get the residuals and add them to the structural equation for supply. Reestimate by least squares and check the t-ratio on the added residual. If it is significant, then p is endogenous. In this example, we confirm the gretl calculation. This suggests that the supply equation can safely be estimated by least squares. Doing so using:
ols q const p pf
reveals that the results are almost identical to those from TSLS. This is an implication of having a Hausman statistic that is so small. See the appendix in Chapter 10 of POE4 for a nice explanation for this.
TSLS of supply, using observations 1-30
Dependent variable: q
Instrumented: p
Instruments: const ps di pf
Coefficient |
Std. Error |
z |
p-value |
|
const |
20.0328 |
1.22311 |
16.3785 |
0.0000 |
pf |
-1.00091 |
0.0825279 |
-12.1281 |
0.0000 |
p |
0.337982 |
0.0249196 |
13.5629 |
0.0000 |
Hausman test -
Null hypothesis: OLS estimates are consistent Asymptotic test statistic: x2(1) = 2.62751e-007 with p-value = 0.999591
Sargan over-identification test - Null hypothesis: all instruments are valid Test statistic: LM = 1.53325 with p-value = P(x2(1) > 1.53325) = 0.215625
Weak instrument test -
First-stage F(2, 26) = 41.4873
Table 11.3: Two-stage least square estimates of the demand of truffles.