1 medhdfe簡介運(yùn)用Stata進(jìn)行中介效應(yīng)分析時(shí),,你是否曾經(jīng)為如何加入時(shí)間固定效應(yīng)和個(gè)體固定效應(yīng)而煩惱呢,? 全新編寫的Stata命令medhdfe 重磅首發(fā),,支持在進(jìn)行中介效應(yīng)分析時(shí)控制多維固定效應(yīng),,讓你和煩惱說拜拜,。 2 medhdfe特點(diǎn)medhdfe 將中介效應(yīng)命令sgmediation2 與多維固定效應(yīng)命令reghdfe 相結(jié)合,完美解決在中介效應(yīng)分析時(shí)如何加入多維固定效應(yīng)的問題,。
相比在sgmediation2 命令中的控制變量部分引入多個(gè)維度虛擬變量,,medhdfe 通過absorb 加入多維固定效應(yīng),極大提高了運(yùn)行速度,。 medhdfe 還支持加入穩(wěn)健標(biāo)準(zhǔn)誤,,包括異方差穩(wěn)健標(biāo)準(zhǔn)誤robust 和聚類穩(wěn)健標(biāo)準(zhǔn)誤cluster 。
3 medhdfe語法medhdfe depvar [if exp] [in range] , iv(indepvar) mv(medvar) cv(ctrlvar) absorb(absvars) [options]
其中,,depvar 為因變量,,indepvar 為自變量,medvar 為中介變量,,ctrlvar 為控制變量,,absvars 為固定維度。 4 medhdfe示例以grunfeld.dta 數(shù)據(jù)集為例,,對medhdfe 命令的運(yùn)用進(jìn)行演示,。 示例以invest 為因變量,mvalue 為自變量,,kstock 為中介變量,,同時(shí)控制company 公司固定效應(yīng)和year 年份固定效應(yīng)。 webuse 'grunfeld', clear medhdfe invest, iv(mvalue) mv(kstock) absorb(company year)
具體結(jié)果如下: Model with dv regressed on iv (path c) reghdfe invest mvalue , absorb(company year) cluster() vce() (MWFE estimator converged in 2 iterations)
HDFE Linear regression Number of obs = 200 Absorbing 2 HDFE groups F( 1, 170) = 76.08 Prob > F = 0.0000 R-squared = 0.8808 Adj R-squared = 0.8604 Within R-sq. = 0.3092 Root MSE = 81.0287
------------------------------------------------------------------------------ invest | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- mvalue | .1799679 .0206334 8.72 0.000 .1392372 .2206986 _cons | -48.70963 23.0425 -2.11 0.036 -94.19591 -3.223356 ------------------------------------------------------------------------------
Absorbed degrees of freedom: -----------------------------------------------------+ Absorbed FE | Categories - Redundant = Num. Coefs | -------------+---------------------------------------| company | 10 0 10 | year | 20 1 19 | -----------------------------------------------------+
Model with mediator regressed on iv (path a) reghdfe kstock mvalue , absorb(company year) cluster() vce() (MWFE estimator converged in 2 iterations)
HDFE Linear regression Number of obs = 200 Absorbing 2 HDFE groups F( 1, 170) = 15.30 Prob > F = 0.0001 R-squared = 0.7127 Adj R-squared = 0.6637 Within R-sq. = 0.0826 Root MSE = 174.6154
------------------------------------------------------------------------------ kstock | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- mvalue | .1739291 .0444647 3.91 0.000 .0861551 .2617031 _cons | 87.88131 49.65618 1.77 0.079 -10.14081 185.9034 ------------------------------------------------------------------------------
Absorbed degrees of freedom: -----------------------------------------------------+ Absorbed FE | Categories - Redundant = Num. Coefs | -------------+---------------------------------------| company | 10 0 10 | year | 20 1 19 | -----------------------------------------------------+
Model with dv regressed on mediator and iv (paths b and c') reghdfe invest kstock mvalue , absorb(company year) cluster() vce() (MWFE estimator converged in 2 iterations)
HDFE Linear regression Number of obs = 200 Absorbing 2 HDFE groups F( 2, 169) = 217.44 Prob > F = 0.0000 R-squared = 0.9517 Adj R-squared = 0.9431 Within R-sq. = 0.7201 Root MSE = 51.7245
------------------------------------------------------------------------------ invest | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- kstock | .3579163 .022719 15.75 0.000 .3130667 .4027659 mvalue | .1177158 .0137513 8.56 0.000 .0905694 .1448623 _cons | -80.16378 14.84402 -5.40 0.000 -109.4674 -50.86019 ------------------------------------------------------------------------------
Absorbed degrees of freedom: -----------------------------------------------------+ Absorbed FE | Categories - Redundant = Num. Coefs | -------------+---------------------------------------| company | 10 0 10 | year | 20 1 19 | -----------------------------------------------------+
Sobel-Goodman Mediation Tests
| Est Std_err z P>|z| ---------------------+------------------------------------------------ Sobel | 0.062 0.016 3.796 0.000 Aroian | 0.062 0.016 3.789 0.000 Goodman | 0.062 0.016 3.804 0.000
Indirect, Direct, and Total Effects
| Est Std_err z P>|z| ---------------------+------------------------------------------------ a_coefficient | 0.174 0.044 3.912 0.000 b_coefficient | 0.358 0.023 15.754 0.000 Indirect_effect_aXb | 0.062 0.016 3.796 0.000 Direct_effect_c' | 0.118 0.014 8.560 0.000 Total_effect_c | 0.180 0.021 8.722 0.000
Proportion of total effect that is mediated: 0.346 Ratio of indirect to direct effect: 0.529 Ratio of total to direct effect: 1.529
5 medhdfe獲取
|