- . sysuse auto, clear
- (1978 Automobile Data)
- . eststo:ivreghdfe price (weight=length), a(foreign) first savefirst savefp(f)
- (MWFE estimator converged in 1 iterations)
- Stored estimation results
- -------------------------
- -----------------------------------------------------------------------------
- name | command depvar npar title
- -------------+---------------------------------------------------------------
- fweight | ivreg2 weight 1 First-stage regression: weight
- -----------------------------------------------------------------------------
- First-stage regressions
- -----------------------
- First-stage regression of weight:
- Statistics consistent for homoskedasticity only
- Number of obs = 74
- ------------------------------------------------------------------------------
- weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
- -------------+----------------------------------------------------------------
- length | 31.445 1.601 19.64 0.000 28.252 34.637
- ------------------------------------------------------------------------------
- F test of excluded instruments:
- F( 1, 71) = 385.64
- Prob > F = 0.0000
- Sanderson-Windmeijer multivariate F test of excluded instruments:
- F( 1, 71) = 385.64
- Prob > F = 0.0000
- Summary results for first-stage regressions
- -------------------------------------------
- (Underid) (Weak id)
- Variable | F( 1, 71) P-val | SW Chi-sq( 1) P-val | SW F( 1, 71)
- weight | 385.64 0.0000 | 401.93 0.0000 | 385.64
- Stock-Yogo weak ID F test critical values for single endogenous regressor:
- 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- NB: Critical values are for Sanderson-Windmeijer F statistic.
- Underidentification test
- Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
- Ha: matrix has rank=K1 (identified)
- Anderson canon. corr. LM statistic Chi-sq(1)=62.49 P-val=0.0000
- Weak identification test
- Ho: equation is weakly identified
- Cragg-Donald Wald F statistic 385.64
- Stock-Yogo weak ID test critical values for K1=1 and L1=1:
- 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- Weak-instrument-robust inference
- Tests of joint significance of endogenous regressors B1 in main equation
- Ho: B1=0 and orthogonality conditions are valid
- Anderson-Rubin Wald test F(1,71)= 32.46 P-val=0.0000
- Anderson-Rubin Wald test Chi-sq(1)= 33.83 P-val=0.0000
- Stock-Wright LM S statistic Chi-sq(1)= 23.22 P-val=0.0000
- Number of observations N = 74
- Number of regressors K = 1
- Number of endogenous regressors K1 = 1
- Number of instruments L = 1
- Number of excluded instruments L1 = 1
- IV (2SLS) estimation
- --------------------
- Estimates efficient for homoskedasticity only
- Statistics consistent for homoskedasticity only
- Number of obs = 74
- F( 1, 71) = 43.55
- Prob > F = 0.0000
- Total (centered) SS = 633558013.5 Centered R2 = 0.4885
- Total (uncentered) SS = 633558013.5 Uncentered R2 = 0.4885
- Residual SS = 324043549.4 Root MSE = 2136
- ------------------------------------------------------------------------------
- price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
- -------------+----------------------------------------------------------------
- weight | 2.869 0.435 6.60 0.000 2.002 3.736
- ------------------------------------------------------------------------------
- Underidentification test (Anderson canon. corr. LM statistic): 62.494
- Chi-sq(1) P-val = 0.0000
- ------------------------------------------------------------------------------
- Weak identification test (Cragg-Donald Wald F statistic): 385.639
- Stock-Yogo weak ID test critical values: 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- ------------------------------------------------------------------------------
- Sargan statistic (overidentification test of all instruments): 0.000
- (equation exactly identified)
- ------------------------------------------------------------------------------
- Instrumented: weight
- Excluded instruments: length
- Partialled-out: _cons
- nb: total SS, model F and R2s are after partialling-out;
- any small-sample adjustments include partialled-out
- variables in regressor count K
- ------------------------------------------------------------------------------
- Absorbed degrees of freedom:
- -----------------------------------------------------+
- Absorbed FE | Categories - Redundant = Num. Coefs |
- -------------+---------------------------------------|
- foreign | 2 0 2 |
- -----------------------------------------------------+
- (est2 stored)
- . est restore fweight
- (results fweight are active now)
- . outreg2 using xxx.doc,cttop(first) replace
- xxx.doc
- dir : seeout
- . est restore est1
- (results est1 are active now)
- . outreg2 using xxx.doc,cttop(second)
- xxx.doc
- dir : seeout
- .
- end of do-file
- . do "/var/folders/38/1b2z7ctd7yd90cdlc7ym_wxm0000gn/T//SD56421.000000"
- . sysuse auto, clear
- (1978 Automobile Data)
- . eststo clear
- . eststo: ivreghdfe price (weight=length), a(foreign) first savefirst savefprefix(f)
- (MWFE estimator converged in 1 iterations)
- Stored estimation results
- -------------------------
- -----------------------------------------------------------------------------
- name | command depvar npar title
- -------------+---------------------------------------------------------------
- fweight | ivreg2 weight 1 First-stage regression: weight
- -----------------------------------------------------------------------------
- First-stage regressions
- -----------------------
- First-stage regression of weight:
- Statistics consistent for homoskedasticity only
- Number of obs = 74
- ------------------------------------------------------------------------------
- weight | Coef. Std. Err. t P>|t| [95% Conf. Interval]
- -------------+----------------------------------------------------------------
- length | 31.445 1.601 19.64 0.000 28.252 34.637
- ------------------------------------------------------------------------------
- F test of excluded instruments:
- F( 1, 71) = 385.64
- Prob > F = 0.0000
- Sanderson-Windmeijer multivariate F test of excluded instruments:
- F( 1, 71) = 385.64
- Prob > F = 0.0000
- Summary results for first-stage regressions
- -------------------------------------------
- (Underid) (Weak id)
- Variable | F( 1, 71) P-val | SW Chi-sq( 1) P-val | SW F( 1, 71)
- weight | 385.64 0.0000 | 401.93 0.0000 | 385.64
- Stock-Yogo weak ID F test critical values for single endogenous regressor:
- 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- NB: Critical values are for Sanderson-Windmeijer F statistic.
- Underidentification test
- Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
- Ha: matrix has rank=K1 (identified)
- Anderson canon. corr. LM statistic Chi-sq(1)=62.49 P-val=0.0000
- Weak identification test
- Ho: equation is weakly identified
- Cragg-Donald Wald F statistic 385.64
- Stock-Yogo weak ID test critical values for K1=1 and L1=1:
- 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- Weak-instrument-robust inference
- Tests of joint significance of endogenous regressors B1 in main equation
- Ho: B1=0 and orthogonality conditions are valid
- Anderson-Rubin Wald test F(1,71)= 32.46 P-val=0.0000
- Anderson-Rubin Wald test Chi-sq(1)= 33.83 P-val=0.0000
- Stock-Wright LM S statistic Chi-sq(1)= 23.22 P-val=0.0000
- Number of observations N = 74
- Number of regressors K = 1
- Number of endogenous regressors K1 = 1
- Number of instruments L = 1
- Number of excluded instruments L1 = 1
- IV (2SLS) estimation
- --------------------
- Estimates efficient for homoskedasticity only
- Statistics consistent for homoskedasticity only
- Number of obs = 74
- F( 1, 71) = 43.55
- Prob > F = 0.0000
- Total (centered) SS = 633558013.5 Centered R2 = 0.4885
- Total (uncentered) SS = 633558013.5 Uncentered R2 = 0.4885
- Residual SS = 324043549.4 Root MSE = 2136
- ------------------------------------------------------------------------------
- price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
- -------------+----------------------------------------------------------------
- weight | 2.869 0.435 6.60 0.000 2.002 3.736
- ------------------------------------------------------------------------------
- Underidentification test (Anderson canon. corr. LM statistic): 62.494
- Chi-sq(1) P-val = 0.0000
- ------------------------------------------------------------------------------
- Weak identification test (Cragg-Donald Wald F statistic): 385.639
- Stock-Yogo weak ID test critical values: 10% maximal IV size 16.38
- 15% maximal IV size 8.96
- 20% maximal IV size 6.66
- 25% maximal IV size 5.53
- Source: Stock-Yogo (2005). Reproduced by permission.
- ------------------------------------------------------------------------------
- Sargan statistic (overidentification test of all instruments): 0.000
- (equation exactly identified)
- ------------------------------------------------------------------------------
- Instrumented: weight
- Excluded instruments: length
- Partialled-out: _cons
- nb: total SS, model F and R2s are after partialling-out;
- any small-sample adjustments include partialled-out
- variables in regressor count K
- ------------------------------------------------------------------------------
- Absorbed degrees of freedom:
- -----------------------------------------------------+
- Absorbed FE | Categories - Redundant = Num. Coefs |
- -------------+---------------------------------------|
- foreign | 2 0 2 |
- -----------------------------------------------------+
- (est1 stored)
- . estadd scalar F = `e(widstat)' : fweight //将第二阶段得到的弱工具变量检验统计量加到第一阶段模型
- > 中
- . esttab fweight est1 using xxx.doc, scalar(F) replace
- (output written to xxx.doc)