示例1
文献来源
fixed effect panel multinomial logit model
- Fentie, A., et al. (2023). Climbing up the ladder: Households' fuel choice transition for lighting in Ethiopia
- Appendix A. Supplementary data【数据+Stata】
示例代码
cd "C:\Download\1-s2.0-S0140988323006606-mmc1\Data and codes"
use EE_paneldata_vars , clear
cap drop count*
bys year lighting_sourcesM : gen count = _N
separate count, by(lighting_sourcesM ) veryshortlabel
eststo clear
gl c = "lighting_sourcesM age_yr gender marstat hh_size education lnconsumption fuelwoodprice keroseneprice"
eststo: xtmlogit $c, fe baseoutcome(0)
eststo: xtmlogit $c if rural==1, fe baseoutcome(0)
esttab est1 est2, mtitles ( "National" "Rural") noomitted
得到结果
note: 1,373 groups (4,119 obs) omitted because of no variation in the outcome variable
over time.
Computing initial values ...
Setting up 3,987 permutations:
....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Fitting full model:
Iteration 0: Log likelihood = -1191.453
Iteration 1: Log likelihood = -1179.0319
Iteration 2: Log likelihood = -1178.6965
Iteration 3: Log likelihood = -1178.6963
Iteration 4: Log likelihood = -1178.6963
Fixed-effects multinomial logistic regression Number of obs = 3,792
Group variable: household_id Number of groups = 1,264
Obs per group:
min = 3
avg = 3.0
max = 3
LR chi2(16) = 510.01
Log likelihood = -1178.6963 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
lighting_so~M | Coefficient Std. err. z P>|z| [95% conf. interval]
--------------+----------------------------------------------------------------
Fuelwood | (base outcome)
--------------+----------------------------------------------------------------
Kerosene |
age_yr | -.0552937 .0185489 -2.98 0.003 -.0916489 -.0189385
gender | 1.056725 .7894323 1.34 0.181 -.4905341 2.603984
marstat | -.0847772 .4042459 -0.21 0.834 -.8770846 .7075301
hh_size | .0151637 .0744581 0.20 0.839 -.1307716 .161099
education | .3720807 .2931895 1.27 0.204 -.2025602 .9467216
lnconsumption | .3851697 .1458601 2.64 0.008 .0992891 .6710502
fuelwoodprice | .0006484 .0005959 1.09 0.277 -.0005196 .0018164
keroseneprice | -.1300765 .0632848 -2.06 0.040 -.2541124 -.0060405
--------------+----------------------------------------------------------------
Electricity |
age_yr | .0282063 .01647 1.71 0.087 -.0040744 .060487
gender | .7776789 .6603377 1.18 0.239 -.5165593 2.071917
marstat | .1738262 .3663797 0.47 0.635 -.5442648 .8919172
hh_size | .0825536 .0687004 1.20 0.230 -.0520966 .2172038
education | .48956 .2711412 1.81 0.071 -.0418671 1.020987
lnconsumption | .7036003 .134969 5.21 0.000 .439066 .9681346
fuelwoodprice | .0025827 .0005528 4.67 0.000 .0014993 .0036661
keroseneprice | .2781815 .0591354 4.70 0.000 .1622782 .3940848
-------------------------------------------------------------------------------
(est1 stored)
.
. eststo: xtmlogit $c if rural==1, fe baseoutcome(0)
note: 1,100 groups (3,300 obs) omitted because of no variation in the outcome variable
over time.
Computing initial values ...
Setting up 3,864 permutations:
....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Fitting full model:
Iteration 0: Log likelihood = -1148.6025
Iteration 1: Log likelihood = -1136.5976
Iteration 2: Log likelihood = -1136.2572
Iteration 3: Log likelihood = -1136.2571
Iteration 4: Log likelihood = -1136.2571
Fixed-effects multinomial logistic regression Number of obs = 3,669
Group variable: household_id Number of groups = 1,223
Obs per group:
min = 3
avg = 3.0
max = 3
LR chi2(16) = 504.80
Log likelihood = -1136.2571 Prob > chi2 = 0.0000
-------------------------------------------------------------------------------
lighting_so~M | Coefficient Std. err. z P>|z| [95% conf. interval]
--------------+----------------------------------------------------------------
Fuelwood | (base outcome)
--------------+----------------------------------------------------------------
Kerosene |
age_yr | -.0564058 .0185961 -3.03 0.002 -.0928536 -.0199581
gender | 1.019603 .7909268 1.29 0.197 -.5305853 2.569791
marstat | -.2465234 .4169169 -0.59 0.554 -1.063665 .5706186
hh_size | .0151971 .0751567 0.20 0.840 -.1321073 .1625015
education | .3488474 .2954153 1.18 0.238 -.2301559 .9278507
lnconsumption | .3896065 .1476706 2.64 0.008 .1001775 .6790356
fuelwoodprice | .0005906 .0005968 0.99 0.322 -.0005791 .0017604
keroseneprice | -.1472234 .0644113 -2.29 0.022 -.2734672 -.0209795
--------------+----------------------------------------------------------------
Electricity |
age_yr | .0276713 .0165029 1.68 0.094 -.0046739 .0600164
gender | .7506788 .66072 1.14 0.256 -.5443085 2.045666
marstat | .0507948 .3811293 0.13 0.894 -.696205 .7977946
hh_size | .0857675 .0693503 1.24 0.216 -.0501565 .2216916
education | .4998226 .2719954 1.84 0.066 -.0332786 1.032924
lnconsumption | .7090874 .1363886 5.20 0.000 .4417707 .9764041
fuelwoodprice | .0025513 .0005526 4.62 0.000 .0014681 .0036344
keroseneprice | .2798158 .0602319 4.65 0.000 .1617634 .3978681
-------------------------------------------------------------------------------
(est2 stored)
.
. esttab est1 est2, mtitles ( "National" "Rural") noomitted
--------------------------------------------
(1) (2)
National Rural
--------------------------------------------
Kerosene
age_yr -0.0553** -0.0564**
(-2.98) (-3.03)
gender 1.057 1.020
(1.34) (1.29)
marstat -0.0848 -0.247
(-0.21) (-0.59)
hh_size 0.0152 0.0152
(0.20) (0.20)
education 0.372 0.349
(1.27) (1.18)
lnconsumpt~n 0.385** 0.390**
(2.64) (2.64)
fuelwoodpr~e 0.000648 0.000591
(1.09) (0.99)
kerosenepr~e -0.130* -0.147*
(-2.06) (-2.29)
--------------------------------------------
Electricity
age_yr 0.0282 0.0277
(1.71) (1.68)
gender 0.778 0.751
(1.18) (1.14)
marstat 0.174 0.0508
(0.47) (0.13)
hh_size 0.0826 0.0858
(1.20) (1.24)
education 0.490 0.500
(1.81) (1.84)
lnconsumpt~n 0.704*** 0.709***
(5.21) (5.20)
fuelwoodpr~e 0.00258*** 0.00255***
(4.67) (4.62)
kerosenepr~e 0.278*** 0.280***
(4.70) (4.65)
--------------------------------------------
N 3792 3669
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
(完)