Pythonによる経済経営分析のデータサイエンス

5.6 回帰分析(4) 操作変数法

linearmodelsをinstallする
pip install linearmodels (Relesed Mar 8,2021) 操作変数法(隠れた要因をあぶりだすための方法?)
データセットは教育歴の既婚女性の給与への効果に関するデータ
f:id:bitop:20210311060226p:plain

データセットの変数の意味  
nlf        1 if in labor force, 1975
hours      労働時間
kidslt6    6歳未満の子供
kidsge6    6歳以上から18歳までの子供
age        女性の年齢
educ       教育年数
wage       賃金からの推定賃金
repwage    1976年のインタビューでrepwageが賃金を報告した
hushrs     夫が働いた時間
husage     夫の年齢
huseduc    夫の学校教育の年
huswage    夫の時給
faminc     家族の収入
mtr        女性が直面している限界税率
motheduc   母親の学校教育の年
fatheduc   父の学校教育の年
unem       unem. rate in county of resid.
city       =1 if live in SMSA
exper      actual labor mkt exper
nwifeinc   (faminc - wage*hours)/1000
lwage      log(wage)
expersq    exper^2

通常の線形回帰
f:id:bitop:20210311061011p:plain  

父親が教育を受けた年数を操作変数として分析をする
f:id:bitop:20210311061305p:plain

通常の回帰分析と操作変数による分析を比較巣r
f:id:bitop:20210311063339p:plain