パネルデータ解析セミナー
慶應義塾大学パネル調査共同研究拠点
2013 年3月4日~7日
I Stata 1
1 3
1.1 Stata . . . 3
1.2 . . . 4
1.2.1 Stata dta . . . 4
1.2.2 csv . . . 4
1.3 . . . 5
1.3.1 . . . 5
1.3.2 . . . 5
1.4 . . . 5
1.4.1 . . . 5
1.4.2 . . . 6
1.4.3 . . . 6
1.4.4 . . . 6
1.5 . . . 6
1.5.1 . . . 7
1.5.2 . . . 7
1.6 . . . 7
1.7 do log . . . 7
1.7.1 do . . . 8
1.7.2 do . . . 8
1.7.3 log . . . 9
1.8 . . . 9
1.9 . . . 10
1.10 . . . 10
1.11 : . . . 11
1.12 Stata . . . 13
2 15 2.1 . . . 15
2.2 . . . 16
2.3 : . . . 17
2.4 . . . 17
2.4.1 . . . 18
2.4.2 . . . 18
2.4.3 . . . 18
2.4.4 . . . 19
2.5 . . . 20
2.5.1 . . . 20
2.5.2 . . . 21
2.5.3 . . . 21
2.6 : . . . 22
2.7 Stata . . . 23
II KHPS 25
3 27 3.1 . . . 283.1.1 . . . 28
3.1.2 . . . 29
3.2 . . . 29
3.2.1 . . . 29
3.2.2 . . . 30
3.3 Stata . . . 31
4 33 4.1 . . . 33
4.2 . . . 33
4.3 . . . 34
4.3.1 . . . 34
4.3.2 . . . 35
4.4 . . . 35
4.4.1 OLS . . . 35
4.4.2 Postestimation . . . 37
4.5 . . . 38
4.5.1 . . . 39
4.5.2 . . . 39
4.5.3 . . . 40
4.6 Stata . . . 41
5 43 5.1 . . . 43
5.2 . . . 43
5.2.1 . . . 43
5.2.2 . . . 44
5.3 . . . 46
5.3.1 . . . 46
5.3.2 . . . 46
5.3.3 . . . 47
5.4 . . . 49
5.4.1 OLS . . . 49
5.4.2 (Heckit) . . . 50
5.5 Stata . . . 51
6 (1) 53
6.1 . . . 53
6.2 . . . 54
6.2.1 . . . 54
6.2.2 DID . . . 54
6.3 . . . 56
6.3.1 . . . 56
6.4 . . . 58
6.4.1 . . . 58
6.4.2 . . . 59
6.4.3 . . . 60
6.5 Stata . . . 61
7 (2) 63 7.1 . . . 63
7.2 . . . 63
7.3 Pooled OLS, , . . . 64
7.4 Hausman . . . 65
7.5 Stata . . . 65
8 (3) 67 8.1 DID . . . 67
8.2 . . . 67
8.2.1 . . . 67
8.2.2 . . . 68
8.3 . . . 69
8.4 . . . 69
8.5 DID . . . 70
9 (1) 73 9.1 . . . 73
9.2 . . . 74
9.3 . . . 74
9.4 . . . 75
9.5 . . . 76
10 (2) 77 10.1 . . . 77
10.1.1 . . . 77
10.1.2 . . . 79
10.2 . . . 80
10.2.1 Cox . . . 80
10.2.2 . . . 81
10.2.3 . . . 82
10.2.4 Kaplan-Meier . . . 82
10.2.5 Cox . . . 83
10.3 Stata . . . 84
(Keio Household Panel Survey, KHPS)
(1)
(2) (3) 3
(Keio Household Panel Survey, KHPS)
(a) KHPS
KHPS
Stata Stata
(b)
KHPS
(c)
Stata
1.
• (2006) .
• (2005) .
• Hsiao, C. (2002), Analysis of Panel Data, Cambridge University Press. , 2007
2.
• Colin R. McKenzie (2009) .
• (2009) .
• Wooldridge, J.M. (2001), Econometric Analysis of Cross Section and Panel Data, MIT Press.
• Cameron, A.C. and P.K. Trivedi (2005), Microeconometrics: Methods and Applications, Cam- bridge University Press.
3. Stata
• (2010) Stata .
• (2007) Stata
.
• Baum, C.F. (2006), An Introduction to Modern Econometrics Using Stata, Stata Press.
• Cameron, A.C. and P.K. Trivedi (2008), Microeconometrics Using Stata, Stata Press.
(Keio Household Panel Survey, KHPS) KHPS
(1) KHPS
(2) KHPS
KHPS
http://www.gcoe-econbus.keio.ac.jp/-keio-household-panel-survey-khps-2.html
1. 2. 3. KHPS
CSV →
H → main
PC
Stata
1
Stata
1.1 Stata
Stata 4
1.1: Stata
(1) Results (2) Command (3) Review
Command (4) Variables
Command (5)
1.2
3
1. Stata .dta
2. .csv
3.
1.2.1 Stata dta
.dta (1) (2) Command
Stata (2)
Stata 1.1 use
H data day1 test04.dta
1. Command
use H:\main\day1\test04.dta
2. Variables test04.dta
H:\main\day1\test04.dta H
→ [main] → [day1] day1
test04.dta
“u H:\main\day1\test04.dta”
1.2.2 csv
dta csv
csv CSV
Stata
1.2 insheet
H main day1 test04.csv
1. Command clear
2. Command
insheet using H:\main\day1\test04.csv
1.3
1.3.1
1.3 set memory Stata
Stata 300
set memory 300m[, permanently]
“, permanently” set memory Stata
[ ]
1.4 set maxvar Stata
Stata 3,000
set maxvar 3000[, permanently]
Stata/SE 5,000
32,767
1.3.2
1.2
cd H:\main\day1 insheet using test04.csv
1.4
1.4.1
1.5 Browse
1.6 list
v1 v3 result
list v1 v3 Stata
result “more” Enter Space
“q”
1.4.2
1.7 describe
describe describe
1.4.3
1.8 summarize
summarize v1 v3 v4 v5 4
summarize v1 v3 v4 v5
summarize
1.4.4
1.9 tabulate
tabulate v6
tabulate 2
tabulate v4 v5
1.5
insheet v1, v2, v3...
1
Variables label
1.5.1
1.10 label variable 1. v6
label variable v6 " " 2. variables
1.5.2
1.11 rename
1. v6 birthy
rename v6 birthy 2. variables
1.6
Stata 1.12 save
H main day1 test04
save H:\main\day1\test04.dta
“, replace”
“, replace”
save H:\main\day1\test04.dta, replace
1 “saveold”
saveold H:\main\day1\test04old.dta
1.7 do log
command
(interactive use) do Stata
1 CSV 1
1.2: do
do
log Stata Stata Result
log Result log
1.7.1 do
do
“.do” 1.2 do 1.2 1
* test04.dta Stata
“*” “/*” “*/”
1.7.2 do
1.13 do
do Stata 3
1 do
2 → “Do...” do
3 Command do : do
do H:\main\day1\ex1 13.do
1.3: Stata
1.7.3 log
1.14 log
log log
1 [File]-[Log]-[Begin...]
2 Command log
log using H:\main\day1\test.log
log “, append”
“, replace”
log “log close” log
log log
Stata
1.8
Stata PC
1.15
2
1 [Help]-[Stata Command...]
2 Command (cmd )
help cmd summarize
“Syntax” “Description”
“Options” “Examples”
1.16
2
1 [Help]-[Search...]
• “Search documen-
tation and FAQs” Stata
“Search net resources” web
“Search all” 2
2 Command word
search word [word... ]
• 1 “local” “net” “all”
1.9
summarize (syntax)
Stata
cmd [varlist ] [=exp ] [weight ] [if ] [in ] [, options ]
cmd varlist
varname
=exp weight if in options
•
“,”
• [ ]
•
1.10
Stata
result 1.4 “file test04.dta
not found” test04.dta
1.4: Stata
1.5:
r(601)
1.5
1.11 :
1.17 do
CSV 2 (test04.csv test05.csv) 1
do 1.6
1. CSV ( : day1 )
2. 3. 2
• “test varlist.xls”
• 2
4.
5. Stata : day1 : test04.dta, test05.dta
1.6: do
1ページ目 2ページ目
* test04.dtaとtest05.dtaを 作 成 clear
set memory 300m set maxvar 3000 set more off cd H:\main\day1
insheet using test04.csv log using test0405.log, replace des
rename v1 x1 rename v3 x3 rename v4 x4 rename v5 x5 rename v6 x6 rename v11 x11 rename v106 x106 rename v751 x306 rename v752 x321 rename v754 x323 label var x1 "id" label var x3 " ネ ル 回 数" label var x4 "配 偶 者 有 無" label var x5 "性 別" label var x6 "生 年"
label var x11 "就 学 就 業 状 況" label var x106 "最 終 学 歴" label var x306 "健 康 状 態" label var x321 "タ コ の 喫 煙"
label var x323 "タ コ 喫 煙 本 数" save test04.dta, replace clear
insheet using test05.csv des
rename v1 x1 rename v3 x3 rename v4 x4 rename v5 x5 rename v6 x6 rename v11 x11 rename v306 x306 rename v321 x321 rename v323 x323 label var x1 "id" label var x3 " ネ ル 回 数" label var x4 "配 偶 者 有 無" label var x5 "性 別" label var x6 "生 年"
label var x11 "就 学 就 業 状 況" label var x306 "健 康 状 態" label var x321 "タ コ の 喫 煙" label var x323 "タ コ 喫 煙 本 数" save test05.dta
log close clear
1.18 KHPS
KHPS
Stata main KHPS2004.csv
KHPS2009.dta do
1. CSV 2. 3.
• 3
v1 year
v2 resp
v3 hhid
• CSV
4.
5. dta ( : main : KHPS2004.dta, KHPS2005.dta,
KHPS2006.dta, KHPS2007dta, KHPS2008.dta, KHPS2009.dta)
1.12 Stata
cd
clear Stata
describe
do do
help
insheet CSV (insheet using XXX.csv)
label variable list
log log (log using XXXX.log) (log close)
rename
save dta
saveold 1
search set memory set maxvar summarize tabulate
use dta
2
2.1
2.1
x1 ID (test04.dta)
(pref2004.dta) 2
2.1 merge Stata
merge 2.1
1. day1 CSV test pref04.csv Stata (insheet
)
2. x1 sort
sort x1
3. Stata : day1
: test pref04.dta
4. (clear ) 1.17
test04.dta
5. test04.dta x1
6. test04.dta
merge x1 using H:\main\day1\test pref04.dta
7.
save H:\main\day1\test04.dta, replace
• replace
8. 2005
merge syntax
merge varlist using filename
varlist filename
2.1:
x1 x3 x4 x1 pref_id
1 1 1 1 18
2 1 2 接続 2 6
←
4004 1 2 4004 40
4005 1 1 4005 23
省略 test_pref04.dta test04.dta
省略
• ID varlist
merge merge
2 3
merge=1 test04.dta
merge=2 test pref04.dta
merge=3
1 1 1
2.2
2.2
2.1 test04.dta test05.dta
2.2 append
Stata append 2.2
1. 2004 (test04.dta)
use H:\main\day1\test04.dta
2. 2004 (test04.dta) 2005 (test05.dta)
append using H:\main\day1\test05.dta
3. : day1 : testpanel.dta
save H:\main\day1\testpanel.dta append
2004
v751 2005 v306
1.17 x306
2.2:
x1 x3 x4 x106
1 1 1 2
2 1 2 2
4005 1 1 4
x1 x3 x4
1 2 1
2 2 2
4005 2 1
↑接続
test04.dta
省略
test05.dta
省略
2004 2005
2005
2.3 :
2.3
1.18 KHPS2004.dta KHPS2009.dta 6 do
1. merge main
pref2004.csv pref2009.csv
• insheet v1 v3
hhid, pref id, pref
• merge hhid
2. append 6 : main
: KHPS seminar.dta 3. summarize describe
2.4
2.4.1
2.4 generate
generate 2.2 testpanel.dta
(year) x3
generate year=2003+x3
year (x6) (age)
generate age=year-x6
generate syntax
generate newvar =exp [if ] [in]
newvar =exp
age year v6
=exp help functions
2.4.2
2.5 replace
replace
(if) x5
1 2
1 0
x5 2 0
replace x5=0 if x5==2
2.4.3
2.6 if
• (==) =
replace x5=0 if x5==2
• (!= ~=)
replace x5=1 if x5~=1
• (>, <, >=, <=)
– old x6 1939 1
gen old=1 if x6<=1939
• (&)
– stud x11 2 7 1
gen stud=1 if x11>=2 & x11<=7
• (|)
– uni x106 4 5 1
gen uni=1 if x106==4|x106==5
• “&” “|”
– smok x3 x321 1 x3 2 x321 1 2
1
gen smok=1 if (x3==1&x321==1)|(x3==2&(x321==1|x321==2))
2.7 replace if
2.2 testpanel.dta (x321)
1 2
9
Stata
“.”
replace x321=. if x321==9 testpanel.dta
2.4.4
2.8 drop keep
drop keep old stud
drop old stud drop
keep x2 x3 smok 3
keep x3 x4 smok
*
x* x
x
keep x*
2.3: bysort
x1 x3 x106 educ
1 1 4 4
1 2 . 4
2 1 2 2
2 2 . 2
3 1 3 3
3 2 . 3
clear testpanel.dta
2.5
2.5.1
2.9 bysort bysort
bysort x5: tab x106
tabulate bysort
2004 (x106) 2005
educ 2.3
bysort x1: egen educ=max(x106)
egen generate (extentions to
generate) max( )
bysort egen educ=max(x106) x106
educ
bysort x1:
max( ) (.) 1 (x1==1)
max(x106) 4
2.5.2
2.10 xtset
xtset x1 x3, yearly
replace x106=L.x106 if x3==2 L.
2 (x3==2) x106
L. 1 (L.xit= xi,t−1)
L2. 2 (L2.xit= xi,t−2)
F. 1 (F.xit= xi,t+1)
F2. 2 (F 2.xit= xi,t+2)
D. (D.xit= xit− xi,t−1)
D2. 2 (D2.xit= (xit− xi,t−1) − (xit−1− xi,t−2))
2.5.3
2.11 foreach
foreach testpanel.dta
sum x323 if x3==1 ( 1 sum x323 if x3==2 2
2 2
x3==1 x3==2 foreach
foreach n of numlist 1 2{ sum x323 if x3==‘n’ }
foreach 1 2
1 “n” 1 2
2 1
‘n’
1 2
foreach syntax
foreach lname of listtype list{ commands referring to ‘lname’ }
• lname
n
• listtype numlist
• list 1
2
1(2)9 1 2 9 (1, 3, 5, 7, 9)
• ‘lname’
‘ ’
• { }
2.12
testpanel.dta x11, x106, x306 3 99
2.5 .
3
replace x11=. if x11==99 replace x106=. if x106==99 replace x306=. if x306==99
x11, x106, x306 foreach
foreach v of varlist x11 x106 x306{ replace ‘v’=. if ‘v’==99
}
2.11 listtype varlist
list
2.6 :
2.13
2.3 KHPS seminar.dta
2.1
2.1:
作成する変数 (label) 変数名 元 る変数
年齢 age year, v6
女性ダミー female v5
現在の会社で の勤務開始年 wkstart v34
現在の会社で の勤続年数 tenure wkstart, v48
仕事からの収入 income v36
2.7 Stata
append (append using filename )
merge (merge varlist using filename )
generate replace drop keep bysort xtset foreach
KHPS
3
Stata
KHPS seminar.dta 3.1
3.1
• 2004 2.9
2005
• (self) 1
0
• (emp) 1
0
• (nonreg)
1
3.1: 3.1
変 数 名 元 に る 変 数
最 終 学 歴 ダ ミ ー: 中 学 校 jrhigh v27
高 校 high v27
短 大 高 専 jrcol v27
大 学 大 学 院 col v27
そ の 他 other v27
就 業 形 態 ダ ミ ー : 自営業 self v32
被雇用 emp v32
非正規雇用 nonreg v32, v33
作 成 す る 変 数 label
3.1
3.1.1
3.2
tabulate
tab female emp
% column % row
% nofreq
missing Stata
3.3 3.2
tab female emp, col tab female emp, row tab female emp, missing
3.4 2
1. (age) 20 (agerank)
• 20 39 20 40 59 40 60 79 60
2. % %
3. (tenure) 10
• 0 9 0 10 19 10 20 29 20 30 39
30 40 40
4. (income) 200
• 200 0 200 400 200 400
600 400 600 800 600 800 1000
800 1000 1000
5.
gen agerank=.
replace agerank=20 if age>=20&age<40 replace agerank=40 if age>=40&age<60 replace agerank=60 if age>=60&age<80
3.1.2
summarize sum v4 v5 v6...
3.5
summarize (income)
sum income
sum income if year==2004 sum income if female==1
summarize Obs Mean Std.Dev
Min Max detail
3.6
3.2
Stata
3.2.1
histogram histogram varname [if ] [in ] [weight ] [, options ]
3.7 (income)
hist income if
hist income if income<=1000
3.2:
プ シ ョ ン 内 容
frequency 度 数 表 示
percent %表 示
title(title) グ ラ フ に 見 出 し を 付 け る xtitle(axix_title) 横 軸 の 見 出 し
ytitle(axix_title) 縦 軸 の 見 出 し
xlabel(a(b)c) 横 軸 の 表 示 形 式 a 目 盛 の 最 小 値 、c 最 大 値 、b 目 盛 間 隔 ylabel(a(b)c) 縦 軸 の 表 示 形 式 a 目 盛 の 最 小 値 、c 最 大 値 、b 目 盛 間 隔
start(#) 横 軸 の 最 小 値
width(#) ヒ ス ト グ ラ ム の 間 隔 addlabel 数 値 ラ ベ ル を 追 加 normal 正 規 分 布 を 追 加 で 表 示 kdensity ー ネ ル 密 度 を 追 加 で 表 示
Graph Editor
3.8 (income)
1. 1000
2. ”Figure 3-1”
3. x ”Annual labor earnings” y ”Frequency”
4. 100
hist income if income<=1000, freq title(Figure3-1) xtitle(Annual labor earnings) ytitle(frequency) width(100) addlabel
Stata
3.9
1 50 2
“Figure 3-2” x “Current job tenure” 3 5 4
5 6 x 1 50 5
hist tenure if tenure<=50, title(Figure3-2) xtitle(Current job tenure) width(5) addlabel kdens xlabel(1(5)50)
3.2.2
2 scatter scatter
scatter y varname x varname [if ] [in ] [,options ]
3.10
1. loginc
gen loginc=log(income)
2. scatter
scatter loginc tenure
title, xlabel, xtitle scatter
Graph Editor
3.11
1 “Job tenure and
annual earnings” x “Current job tenure” y “log(annual earnings)”
2 (small circle) 3 (black) 4
(small) (2) (4) graph editor
scatter loginc tenure, title(Job tenure and annual earnings)
xtitle(Current job tenure) ytitle(log(annual earnings))
graph box( ) graph pie
( ) Stata
3.3 Stata
histogram scatter
4
4.1
(1999) (2001)
KHPS 2007
4.2
KHPS (Ordinary Least Square, OLS)
yi xki
yi= α + β1x1i+ β2x2i+ · · · + ui (4.1)
ui 2 (α, β1, β2, · · · )
Stata regress
regress depvar varlist [if ] [in ] [, options ]
depvar varlist
(2007) (2008)
2
4.1:
差 = 23年
学 卒 時 調 査 時 点
18歳 41歳
1981年 2004年
gradyear = 2004 - 23
4.3
4.3.1
4.1
(grad unemp)
1. (gradage)
2. (year) (age) 1
(gradyear)
3. 2 gradyear
• 1
gen gradage=.
replace gradage=15 if jrhigh==1 replace gradage=18 if high==1 replace gradage=20 if jrcol==1 replace gradage=22 if col==1 label var gradage " "
• 2
gen gradyear=year-(age-gradage) replace gradyear=. if age<gradage label var gradyear " "
• 3
– unemp.csv CSV
Stata insheet using H:\main\day1\unemp.csv sort gradyear
save H:\main\day1\unemp.dta
– KHPS
merge gradyear using H:\main\day1\unemp.dta label var grad unemp " (%)"
4.3.2
4.2 2
(age) (tenure) 2
gen agesq=age^2 gen tenuresq=tenure^2
4.3
sum income loginc female jrhigh high jrcol col age tenure self emp nonreg grad unemp
4.4
4.4.1 OLS
4.4
(loginc) 2
2 2004
reg loginc age agesq female high-col tenure tenuresq nonreg grad unemp if year==2004&emp==1
reg loginc age agesq high-col tenure tenuresq nonreg grad unemp if year==2004&emp==1&female==0
reg loginc age agesq high-col tenure tenuresq nonreg grad unemp if year==2004&emp==1&female==1
high - col
Variable high col
4.1:
Stataの 表 記 内 容
Number of obs. サ ン プ ル サ イ ズ
R-squared 決 定 係 数
F F検定統計量 (H0: 回帰係数 = 0)
Prob>F F検定のp値
Adj. R-squared 自 由 度 修 正 済 み 決 定 係 数
Coef. 回 帰 係 数
Std.Err. 回 帰 係 数 の 標 準 誤 差
t 回 帰 係 数 のt値
P>|t| 回 帰 係 数 のp値 95% Conf. Interval 係 数 の95%信頼区間
Stata 4.1
• (semi-log)
1
1
log(y) = α + βx + u (4.2)
y
y = eα+βx+u (4.3)
x
∂y
∂x = βe
α+βx+u= βy (4.4)
β
β = ∂y/∂x
y (4.5)
∂y/∂x x y y
y
−0.072 1 (1%) 7.2%
• 2
y x
y = a + bx + cx2 (4.6)
x
∂y
∂x = b + 2cx (4.7)
x
0.0322 2 −0.0004
4.2:
2 4.2
x 40
Stata
White (1980) robust
robust 4.5 White (1980)
reg loginc age agesq high-col female tenure tenuresq nonreg grad unemp if year==2004&emp==1,robust
4.6 e(sample)
sum income loginc female jrhigh high jrcol col age tenure self emp nonreg grad unemp if e(sample)
e(sample)
1 if e(sample) if e(sample)==1
ereturn list
4.4.2 Postestimation
predict
predict newvar [if ] [in ] [,options ]
4.2: 4.8
作 成 す る 変 数 変 数 名 元 る 変 数
業 種 ダ ミ ー: 農 林 漁 業 鉱 業 ダ ミ ind1 v30
建 設 業 ダ ミ ind2 v30
製 造 業 ダ ミ ind3 v30
卸 売 小 売 飲 食 宿 泊 業 ダ ミ ind4 v30
金 融 保 険 不 動 産 ダ ミ ind5 v30
運 輸 業 ダ ミ ind6 v30
情 報 通 信 業 ダ ミ ind7 v30
電 気 ガ ス 水 道 医 療 福 祉 業 ダ ミ ind8 v30
教 育 学 習 支 援 そ の 他 サ ビ ス 業 ダ ミ ind9 v30
公 務 及 び そ の 他 業 種 ダ ミ ind10 v30
企 業 規 模 ダ ミ ー: 企 業 規 模 1-4人 ダ ミ fmsz1 v31
企 業 規 模 5-29人 ダ ミ fmsz2 v31
企 業 規 模 30-99人 ダ ミ fmsz3 v31
企 業 規 模 100-499人 ダ ミ fmsz4 v31
企 業 規 模 500人 以 上 ダ ミ fmsz5 v31
企 業 規 模 官 公 庁 ダ ミ fmsz6 v31
労 働 組 合 加 入 ダ ミ ー union v35
有 配 偶 ダ ミ ー marr v4
newvar predict
residual help regress postestimation
4.7
predict pred loginc
label var pred loginc "loginc " predict pred res, residuals
label var pred res " "
4.8
(v30) (v31) (v4)
robust 4.2
4.5
4.5.1
0 1
Stata probit logit
4.9
(nonreg) 2
2004
probit nonreg age agesq female high-col grad unemp if year==2004&emp==1
probit nonreg age agesq high-col grad unemp if year==2004&emp==1&female==0 probit nonreg age agesq high-col grad unemp if year==2004&emp==1&female==1
4.5.2
y x y = 1
Pr(y = 1|x) = Φ (xβ) (4.8)
Φ (·) k xk
∂ Pr(y = 1|x)
∂xk
= φ (xβ) βk (4.9)
φ (·) βk k (4.9)
xk
x
¯
x 1
dprobit 2
4.10
4.9 dprobit
dprobit nonreg age agesq female high-col grad unemp if year==2004&emp==1
1 Average Partial Effect (APE)
xi APE
AP E=∑
iφ(xiβ) βk
2 1 0
Stata
*
4.5.3
(1) (2)
(3) 3
4.11
wkst 1
2 3
wkst
4.11 3
Stata mlogit 4.12
(wkst) 2
2004
mlogit wkst age agesq female high-col grad unemp if year==2004
mlogitwkst age agesq high-col grad unemp if year==2004&female==0 mlogitwkst age agesq high-col grad unemp if year==2004&female==1
4.13
mlogit mfx, predict(p outcome(# ))
# 4.12
mfx, predict(p outcome(1))
nose
4.6 Stata
ereturn list dprobit mfx mlogit predict probit
regress 2
robust (regress )
5
5.1
1
1.
2
2.
3
KHPS
KHPS
4
5.2
Oaxaca (1973)
Oaxaca (1973), Neuman and Oaxaca (2004) KHPS
5.2.1
ln Wi= β0+ β1Educi+ β2Expi+ β3T enurei+ ui (5.1)
1Mincer (1985) (2004) 100
79.4 2003 80.6 1999 66.8 2003
2OECD (2002)
3Oaxaca (1973) (1991) (2003) Johnes and Tanaka (2008) Miyoshi (2008)
4 (2008)
i ln Wi
i 1 Educ T enure
Exp
Mincer (1962)
ln W, Educ, T enure, Exp β0, β1, β2, β3
(5.1) F emale
ln Wi = βi0+ βi1Educi+ βi2Expi+ βi3T enurei+ βi4F emalei+ ui (5.2) F emale β4
Educ Exp T enure
ln Wi= β0m+ β1mEduci+ β2mExpi+ β3mT enurei+ umi (5.3) ln Wi = β0f+ β1fEduci+ β2fExpi+ β3fT enurei+ ufi (5.4)
H0=
βm1
βm2
βm3
=
β1f
β2f β3f
5
5.2.2
(5.1)
(ln W ) Stata
(5.1)
(5.2) F emale
5Oaxaca (1973)
Stata (oaxaca)
(5.1) β0, β1, β2, β3
Heckman (1979) (5.1)
Heckman (1979)
i
d∗i = Ziα + εi
di= 1 [d∗i > 0] (5.5)
di i di = 1 di= 0
1 [·] (index function) [·] 1
d∗i > 0 di= 1 i di= 0
i d∗i
εi
(5.4)
i Zi Zi
ln Wi∗= Xiβ + ui
d∗i = Ziα + εi
di= 1 [d∗i > 0] ln Wi= di(ln Wi∗) [ ui
εi
]
∼ N ID (0, Σ)
Σ =
[σ2 ρσ ρσ 1
]
(5.6)
Xi Zi
Zi Xi
Heckman (1979)
(5.2) (5.3) (5.4)
5.3
0 3 4 6
5.3.1
KHPS KHPS
5.1
wage logwage
1. (v38) 1 (v39)
mearn
2. v46 wkhr
3. 1 2 wage
4.
wage
5. logwage
• (mearn)
gen mearn=1000*v39 if (v38==1|v38==2)&(v39~=88888&v39~=99999)
label var mearn " , "
• (wkhr)
gen wkhr=v46 if v46~=888&v46~=999 label var wkhr " "
5.3.2
(emp==1)
(v38==1) (v38==2) (v38==4)
5.2
wdummy wdummy
1 0
gen wdummy=.
replace wdummy=1 if wage~=. replace wdummy=0 if v32==8
5.3.3
(netfin) (sincome) 0 3
(noku3) 4 6 (noku6) (exp)
1 5.3
netfin sincome
•
gen sincome=v37
replace sincome=0 if v37==88888 replace sincome=. if v37==99999 label var sincome " "
•
gen saving=v457
replace saving=. if v457==999999 label var saving " " ...
5.4
p.1 2
3 noku3 2 10
3
noku3 4 6
(noku6) (noku3)
5.1: KHPS
1. noku3
gen noku3=0
2. p.1 2 3
noku3 1 (noku3=noku3+1)
replace noku3=noku3+1 if ((v8==1&marr==0)|(v8==2&marr==1))
&v9>=year-3&(v9~=9999&v9~=8888)
2 1
3. 3
replace noku3=noku3+1 if ((v10==1&marr==0)|(v10==2&marr==1))
&v11>=year-3&(v11~=9999&v11~=8888) ...
• 2 10
foreach
gen noku3=0
foreach n of numlist 8(2)24{ local k=‘n’+1
replace noku3=noku3+1 if ((v‘n’==1&marr==0)|(v‘n’==2&marr==1))
&v‘k’>=year-3&(v‘k’~=9999&v‘k’~=8888) }
local k=‘n’+1 k foreach
n 1
KHPS 5.1
18 v151 1
19 v152 1
18 v202 1 19 v203 1
KHPS 5.5
exp
2 (expsq)
exp
gen exp=0
replace exp=exp+1 if v151==1|v202==1 replace exp=exp+1 if v152==1|v203==1 ...
foreach
gen exp=0
foreach n of numlist 151(1)201{ local k=‘n’+51
replace exp=exp+1 if v‘n’==1|v‘k’==1 }
5.4
(5.2)
(5.3) (5.4) 6
local indep "exp expsq tenure tenuresq high jrcol col other"
‘indep’ "exp expsq tenure tenuresq high jrcol
col other" Stata 2004
5.4.1 OLS
1 regress (5.2) (5.3) (5.4)
5.6 (5.2)
(5.2) reg logwage ‘indep’ female if year==2004
6 (5.2) (5.3)
(5.3) (5.4)
5.7 (5.3) (5.4) (5.3)
reg logwage ‘indep’ if year==2004&female==0
mb mv
matrix mb= e(b) matrix mv= e(V)
matrix e(b) e(V)
(5.4)
reg logwage ‘indep’ if year==2004&female==1 matrix fb=e(b)
matrix fv=e(V)
5.8
matrix teststats=(mb-fb)*inv(mv+fv)*(mb-fb)’ matrix list teststats
(5.2) teststats
7
5.4.2 (Heckit)
(5.5) (5.5)
regress Stata
(5.5) (5.4)
5.9
local indep2 "exp expsq high jrcol col other noku3 noku6 netfin sincome" (wdummy)
7 Hausman
(5.5) heckman
5.10 (Heckit)
heckman
heckman logwage ‘indep’ female if year==2004, select(wdummy = ‘indep2’ female)
heckman logwage ‘indep’ if year==2004&female==0, sel(wdummy = ‘indep2’) matrix mb=e(b)
matrix mv=e(V)
heckman logwage ‘indep’ if year==2004&female==1, sel(wdummy = ‘indep2’) matrix fb=e(b)
matrix fv=e(V)
matrix teststats=(mb-fb)*inv(mv+fv)*(mb-fb)’ matrix list teststats
5.11 1
5.5 Stata
heckman (Heckit)
local matrix matrix list
6 (1)
6.1
1 6.1 x ID
N
1, 2, · · · , T 2
3
6.1
xit i t
xit i t
1. 2.
6.1:
観 測 時 点
パ ネ ル ID 1 2 3 …
t…
T1
x11 x12 x13…
x1t…
x1T2
x21 x22 x23…
x2t…
x2T3
x31 x32 x33…
x3t…
x3T: : : : : :
i xi1 xi2 xi3
…
xit…
xiT: : : : : :
N xN1 xN2 xN3
…
xNt…
xNT1 (longitudinal data)
2
7-1
3 (repeated
cross-section data)
6.2: N
= 2,693
I II III IV V Total
I 66.5% 24.4% 5.2% 2.0% 2.0% 100.0%
II 26.7% 47.2% 19.1% 6.0% 1.0% 100.0%
III 10.4% 23.3% 42.3% 17.9% 6.0% 100.0%
IV 4.6% 6.6% 23.1% 47.8% 18.0% 100.0%
V 2.1% 2.6% 4.9% 20.7% 69.7% 100.0%
20.0% 20.2% 19.8% 19.7% 20.3% 100.0%
所得五分位 2004年
Total
所得五分位
2005年
注: KHPS2004およびKHPS2005より作成。
6.2
6.2.1
20%
2 2
6.2 KHPS
6.2 2004 2005
4 2004
100
20% 6.2
2004 2/3 2005
10%
6.2.2 DID
DID (Difference-in-Differences, )
(y)
t = 1 t = 2
4 0.5
KHPS (2007)
yTt (t = 1, 2)
yT1 = µT+ φ1
yT2 = µT+ φ2+ δ (6.1)
(6.1) µT
φt δ 5
∆yT ≡ yT2 − y1T = δ + (φ2− φ1) (6.2)
(6.2) Before-After comparison φ1= φ2
δ φ1 ̸= φ2 (6.2)
(φ2> φ1)
(δ = 0) (6.2)
(6.1) 2
(6.1)
y1C= µC+ φ1
y2C= µC+ φ2 (6.3)
(1)
(µT ̸= µC) (2)
δ = 0 2
(6.2)
∆yC ≡ yC2 − yC1 = (φ2− φ1) (6.4)
DID (6.2)
(6.4)
∆yT − ∆yC= [δ + (φ2− φ1)] − (φ2− φ1) = δ (6.5)
i t
yit
yit= xitβ + γ1dT + γ2d2+ δdT · d2+ εit (6.6)
xit etc. dT i
d2 (t = 2) 1 β, γ1, γ2, δ
5
εit (6.6) 2 δ (6.5) DID
(6.6) DID
2
DID
6 (6.6) DID
(E [dTεit] = 0)
(6.6) δ
7 DID
KHPS DID 8
6.3
6.3.1
OJT (on the job training)
(OJTit) (wit)
N (i = 1, 2, · · · , N ) T (t = 1, 2, · · · , T )
log (wit) = βOJTit+ δi+ εit (6.7)
δi εit δi
δi
OJT
OJT β 8
(6.7) 2 Pooled OLS
uit≡ δi+ εit 2 β βˆOLS
βˆOLS =Cov (OJTit, log (wit)) Var (OJTit)
= Cov (OJTit, βOJTit+ uit) Var (OJTit)
= β +Cov (OJTit, uit)
Var (OJTit) (6.8)
6 DID Bertrand et al. (2004)
7
(regression discontinuity)
8 β
(N ) β
6.1: OLS β
(6.8) βˆOLS OJTit uit (Cov (OJTit, uit) = 0)
β βˆOLS
δi
OJT OJTit δi (uit)
(Cov (OJTit, uit) > 0) OJT (β > 0)
OLS
6.1 δi OJTit δi
2 OJTit OLS OJT
δi
OLS OJTit
(Fixed-Effects model, FE) (6.7)
T
∑
t=1
log (wit) =β
T
∑
t=1
OJTit+
T
∑
t=1
δi+
T
∑
t=1
εit (6.9)
T
log (wi) = βOJTi+ δi+ ¯εi (6.10)
log (wi) = 1 T
T
∑
t=1
log (wit) , OJTi= 1 T
T
∑
t=1
OJTit, ε¯i= 1 T
T
∑
t=1
εit (6.11)
6.2:
δi δi
(6.10) (6.7)
log (wit) − log (wi) = β(OJTit− OJTi) + (εit− ¯εi)
log (wit)∗= βOJTit∗+ ε∗it (6.12) (6.11) (6.7)
(within estimator) 9 (6.11)
δi OJTit OLS
(Random-Effects model, RE)
OLS δi
β KHPS
OLS, FE, RE 7
6.4
6.4.1
KHPS
6.2 6.2 hhid ID
year 2004 2009 6
9 1 (First-Difference estimator, FD)
(Least-Squares Dummy Variable estimator, LSDV)
6.3: KHPS (xtdes)
6.1
1. KHPS seminar.dta
use H:\main\KHPS seminar.dta
2.
drop if resp==0
3. xtset
xtset hhid year, yearly
xtset hhid ID year
yearly
6.4.2
6.2 xtdes
xtdes
6.3 5 57% 2 6
17% 11% 6% 5% 4%
5
6.4.3
1
x y
gen y=L.x
“L.” x (L.xit= xi,t−1)
Stata
L. 1 (L.xit= xi,t−1)
L2. 2 (L2.xit= xi,t−2)
F. 1 (F.xit= xi,t+1)
F2. 2 (F 2.xit= xi,t+2)
D. (D.xit= xit− xi,t−1)
D2. 2 (D2.xit= (xit− xi,t−1) − (xit−1− xi,t−2)) 6.3
(v27) 2004 2005
2005
1. 2005 x27 2004
replace v27=L.v27 if year==2005
2. 2006 2005
replace v27=L.v27 if year==2006
3. 2009
4. : jrhigh / : high / : jrcol / : col /
: other
1 3 2005 2009
foreach n of numlist 2005(1)2009{ replace v27=L.v27 if year==‘n’ }
6.4
(marr) (female) (age)
6.5
xtsum
xtsum jrhigh high jrcol col other marr female age
6.5 Stata
xtdes xtset xtsum
7 (2)
7.1
6.3
1
1
2
2
6.3
log (wit) = α + βtenureit+ xitγ + δi+ εit (7.1)
log (wit) tenureit δi i
xit
7.2
(logwage)
(emp=1)
7.1:
変 数 名 内 容
年 齢 (age) 対 象 者 の 年 齢
性 別 (female) 対 象 者 の 性 別 ダ ミ ー 女 性 = 1
最 終 学 歴 (jrhigh-other) 対 象 者 の 最 終 学 歴 ダ ミ ー 中 卒 が 基 準 非 正 規 雇 用 ダ ミ ー (nonreg) 非 正 規 雇 用 ダ ミ ー 正 規 雇 用 が 基 準
企 業 規 模 (fmsz1-fmsz6) 企 業 規 模 ダ ミ ー fmsz1: 1~4人 / fmsz2: 5~29人 / fmsz3: 30~99人 /fmsz4: 100~499人 /fmsz5: 500
人 上 / fmsz6: 官 公 庁 fmsz1が 基 準
地 域 ダ ミ ー (rg1–rg8) 全 国8地 域 ダ ミ ー 北 海 道 が 基 準
市 郡 規 模 ダ ミ ー (bigcity / city) 市 郡 規 模 政 指 定 都 市 = 1 / そ の 他 の 市 =1 調 査 年 度 ダ ミ ー (year2004–year2008) 調 査 年 度 ダ ミ ー 2004年 が 基 準
1 (2006)
7.1
(rg1-rg8) (bigcity, city, town)
(year2004-year2009)
7.2 xtsum
xtsum wage logwage tenure age female jrhigh-other nonreg fmsz1-fmsz6 rg1-rg8 bigcity-town year2004-year2009 if emp==1
7.3 Pooled OLS, ,
7.3 OLS
OLS regress
reg logwage tenure age female high-other nonreg fmsz2-fmsz6 rg2-rg8 bigcity city year2005-year2009 if emp==1, robust 6.3
xtreg
xtreg depvar indepvars [in ] [if ] [, (re/fe) i(idvar ) robust]
• re fe
• i(idvar ) ID xtset
• robust White
7.4 7.3
xtreg logwage tenure age female high-other nonreg fmsz2-fmsz6 rg2-rg8 bigcity city year2005-year2009 if emp==1, re
7.5 (within estimator)
7.3
xtreg logwage tenure nonreg fmsz2-fmsz6 rg2-rg8 bigcity city year2005-year2009 if emp==1, fe 6.3
(6.12)
7.4 Hausman
δi
Hausman
βF E βRE Hausman
H0: βRE= βF E
(βF E− βRE) VH−1(βF E− βRE)′∼ χ2(k)
VH 2 k 2
Hausman
7.6 Hausman
7.4 7.5 Hausman Stata hausman
1. 7.4 estimates store
re
estimates store re
2. 7.5 estimates store
fe
estimates store fe
3. Hausman
hausman fe re
hausman syntax
hausman name-consistent [name-efficient ] [,options ] name-consistent
name-efficient δi
7.7
7.5 Stata
estimates store
hausman Hausman
xtreg re: fe:
8 (3)
8.1 DID
DID
1
1,000
8.1
70 76 38 + 38
2004 (a)
2
3
8.2
DID
KHPS 2
8.2.1
7.3 DID (6.1)
8.1:
2004年 2005年
ト ト メ ン ト グ プ : 有 配 偶 者 影 響 あ り 影 響 な し
コ ン ト ロ グ プ : 無 配 偶 者 影 響 な し 影 響 な し
1 McKenzie (2006)
2 8.1 (a)
3
McKenzie (2006)
8.1: 2004
(6.3) 8.1
1 DID
2 KHPS
2004 2003
KHPS 1 2003
8.1 2004 1
8.1
4
McKenzie (2006)
8.2.2
KHPS 2004
2004
5
8.2
4 2003 DID
5 2005
8.2:
2004年 2005年
ト ト メ ン ト グ プ :
有 配 偶 者 制 度 変 更 を 知 な か っ た
影 響 あ り 影 響 な し
コ ン ト ロ グ プ :
無 配 偶 者 + 有 配 偶 者 制 度 変 更 を 知 っ て い た
影 響 な し 影 響 な し
8.3:
変 数 名 内 容
年 齢 (age) 対 象 者 の 年 齢
配 偶 関 係 (marr) 対 象 者 の 配 偶 関 係 ダ ミ ー 有 配 偶 = 1
最 終 学 歴 (jrhigh-other) 対 象 者 の 最 終 学 歴 ダ ミ ー 中 卒 が 基 準
被 雇 用 就 業 (emp) 被 雇 用 就 業 ダ ミ ー 被 雇 用 者 = 1
非 正 規 雇 用 (nonreg) 非 正 規 雇 用 ダ ミ ー 非 正 規 雇 用 = 1
世 帯 員 数 (hhnum) 本 人 を 含 む 世 帯 員 数
配 偶 者 の 年 間 所 得 (sincome) 配 偶 者 の 年 間 所 得 無 配 偶 者 ゼ ロ
3 の 子 供 の 数 (noku3) 3 未 満 の 未 就 学 児 童 数
4 6 未 満 の 子 ど も の 数 (noku6) 4 6 未 満 の 子 ど も の 数
市 郡 規 模 ダ ミ ー (bigcity / city) 市 郡 規 模 政 指 定 都 市 = 1 / そ の 他 の 市 =1
8.3
Hit= α + β0dTi + β1d04t + β2dTi × d04t + xitγ + εit (8.1)
Hit (wkhr) dTi 1
d04t 2004 1 xit
8.3
dTi × d04t 2004 1
β2 8.1 8.2
β2< 0
2004 2005 2 2004
1
8.4
8.1 2006
keep if year==2004|year==2005
8.2
8.2 2
1. 2004 (treat1)
gen treat1=marr if year==2004
replace treat1=L.treat1 if year==2005
label var treat1 "Treatment 1: 2004 "
2. 2004 (treat2)
gen unaware=0
replace unaware=1 if v44==2
replace unaware=. if v44==8|v44==9|v44==. replace unaware=L.unaware if year==2005
label var unaware " = 1 "
gen treat2=unaware*treat1
label var treat2 "Treatment 2: 2004 "
8.3 2004
8.2 2004 (dTi × d04t
) gen treat1 04=treat1*year2004
label var treat1 04 "Treatment 1× 2004 " gen treat2 04=treat2*year2004
label var treat2 04 "Treatment 2× 2004 "
8.4
v7 (hhnum)
8.5 2004
2004 1
gen work04=1 if year==2004&wkhr>0&wkhr~=. replace work04=L.work04 if year==2005
label var work04 "2004 1 "
8.5 DID
8.6
(6.5) tab treat1 year if female==1&work04==1, sum(wkhr)
8.7 2004
treat1 (8.1)
reg wkhr treat1 treat1 04 year2004 age marr high-other emp nonreg hhnum sincome noku3 noku6 bigcity city if female==1&work04==1,robust
8.8
treat2 8.6 8.7
8.9
8.2 DID
8.2
9 (1)
9.1
9 10 1
2
9.1
9.1
25
10 9.2
9.2 10 27
25
9.1:
年 齢 配 偶 関 係 初 婚 年 齢
67 既 婚 19
34 既 婚 31
24 未 婚 .
50 既 婚 22
47 既 婚 25
43 既 婚 29
27 未 婚 .
66 離 死 別 21
27 未 婚 .
48 既 婚 28
1 (event history analysis) (hazard analysis) (survival
analysis) (duration analysis)
2 (2001-02) Yamaguchi (1991)
9.2: 10 年 齢 配 偶 関 係 初 婚 年 齢
67 既 婚 19
34 既 婚 31
24 既 婚 34
50 既 婚 22
47 既 婚 25
43 既 婚 29
27 既 婚 32
66 離 死 別 21
27 既 婚 29
48 既 婚 28
9.2
3
9.1
9.3
9.1 9.1
KHPS
2004 2009
(A) (F) (A)
(B)
(C) (B)
(D)
(E)
(F)
3
9.1:
イ ベ ン ト 発 生 観 察 打 ち 切
△
○
×
ス 期 間 開 始
左 ト ン ー シ ョ ン
左 セ ン サ ン
右 セ ン サ ン
右 セ ン サ ン
観 察 さ ス 期 間
観 察 さ な い ス 期 間
観 察 開 始 観 察 打 ち 切
(A)
(B)
(C)
(D)
(E)
(F)
△
△ ×
△ ○
○
△
○
△
○
?
9.4
t = 1, 2, · · · h (t)
t t
h (t) = Pr (T = t|T ≥ t) (9.1)
T S (t) t
S (t) = Pr (T > t) (9.2)
S (0) = 1
S (t + 1) = S (t) · (1 − h (t + 1)) (9.3)
t + 1 S (t + 1) t
(S (t)) t + 1 (1 − h (t + 1))
9.3 100
Et t Rt t
100 t = 1 40
(E1= 40) t = 1 60 (= 100 − 40)
(R1= 60) t = 2 30 (E2= 30) t = 2
30 (R2= 100 − E1− E2= 100 − 40 − 30 = 30)
h (t) S (t) t = 1
R1= 60 S (1) = 60/100 = 0.6
9.3:
t =
0 1 2 3 4
Et
― 40 30 20 10
Rt
100 60 30 10 0
h
(t ) ― 0.4 0.5 1/3 1
S
(t ) 1 0.6 0.3 0.1 0
リ ス ク 期 間
tt = 1 t = 0
100 t = 1 h (1) = 40/100 = 0.4
t = 2 S (2) = R2/100 = 30/100 = 0.3 h (2) = E2/R1= 0.5
(9.3) S (0) × (1 − h (1)) = 1 × (1 − 0.4) = S (1) S (1) × (1 − h (2)) = 0.6 ×
(1 − 0.5) = 0.3 N
S (t) = Rt N =
N −∑tk=1Ek
N (9.4)
h (t) = Et
Rt−1 (9.5)
S (t) · (1 − h (t + 1)) = Rt N ·
(
1 −Et+1 Rt
)
= Rt− Et+1
N =
N −∑t+1k=1Ek
N = S (t + 1) (9.6)
9.5
h (t)
h (t; xit) = f (xitβ) (9.7)
t = T
Li= S (t − 1) · h (t) = {T −1
∏
k=1
[1 − f (xikβ)] }
· f (xiTβ) (9.8)
Li= S(T ) =
T
∏
k=1
[1 − f (xikβ)] (9.9)
10 (2)
10.1
2
h (t; xit) = 1
1 + exp [− (λ (t) + xitβ)] (10.1)
xit β λ (t)
xit β
1 x 1 exp (β)
KHPS
10.1.1
10.1
1 1
1
1 (wkchng)
1.
xtset hhid year, yearly
2. (wkstate)
gen wkstate=F.v48
label var wkstate " 1 "
1
h(t; xit) 1 − h (t; xit)
3. 1 (wkchng) gen wkchng=0
replace wkchng=1 if wkstate==4|wkstate==6 replace wkchng=. if wkstate==99|wkstate==. replace wkchng=. if emp==0
10.2 (t)
1.
• 1 9
t0109 1 9 t1014 10 14 t1519 15 19 t2029 20 29
t3060 30
2. (logt)
1.
foreach n of numlist 1(1)9{ gen t‘n’=0
replace t‘n’=1 if tenure==‘n’ replace t‘n’=. if tenure==. }
gen t1014=0
replace t1014=1 if tenure>=10&tenure<15 replace t1014=. if tenure==.
gen t1519=0
replace t1519=1 if tenure>=15&tenure<20 replace t1519=. if tenure==.
gen t2029=0
replace t2029=1 if tenure>=20&tenure<30 replace t2029=. if tenure==.
gen t3060=0
replace t3060=1 if tenure>=30&tenure<100 replace t3060=. if tenure==.
2.
gen logt=log(tenure)
(unemp)
10.3
unemp gen unemp=.
replace unemp=4.71 if year==2004 replace unemp=4.42 if year==2005 replace unemp=4.13 if year==2006 replace unemp=3.85 if year==2007 replace unemp=3.98 if year==2008 replace unemp=5.08 if year==2009 label var unemp " "
10.1.2
10.4
3 logit
robust White
or β exp (β)
1.
logit wkchng t2-t3060 age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust or
2. 2
logit wkchng tenure tenuresq age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust or
3.
logit wkchng logt age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust or
10.5
10.4 mfx
1.
logit wkchng t2-t3060 age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust
mfx
2. 2
logit wkchng tenure tenuresq age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust
mfx
3.
logit wkchng logt age agesq female high jrcol col other nonreg fmsz2-fmsz6 unemp, robust
mfx
10.2
9
KHPS
10.2.1 Cox
Cox Cox
h (t; xit) = λ0(t) φ (xit, β) (10.2)
λ0(t) φ (xit, β) xit
λ0 φ λ0(t)
2 φ (·) φ (xit, β) = exp (xitβ)
2 Cox (1972, 1975) Cameron and Trivedi (2005, p.594)
Stata stphplot stcoxkm
10.2.2
2005 2005
keep if year==2005
10.6 (duration)
1. duration
18 16
gen duration=.
replace duration=v462-18 if female==0&(v461==2|v461==8)&v462~=99 replace duration=v462-16 if female==1&(v461==2|v461==8)&v462~=99
2. duration 2005
replace duration=age-18 if female==0&v461==1 replace duration=age-16 if female==1&v461==1 3.
label var duration " "
10.7 (evermarr)
Stata
1 0
gen evermarr=.
replace evermarr=1 if (v461==2|v461==8)&v462~=99 replace evermarr=0 if v461==1
label var evermarr " = 1 "
10.8 (bc40, bc50, bc60, bc70) 4
1950 50 60 70 4
1.
gen bc=.
replace bc=40 if v6>=1930&v6<1950 replace bc=50 if v6>=1950&v6<1960 replace bc=60 if v6>=1960&v6<1970 replace bc=70 if v6>=1970&v6<1990
2.
foreach n of numlist 40(10)70{ gen bc‘n’=0
replace bc‘n’=1 if bc==‘n’ }
10.2.3
stset
10.9
stset duration, failure(evermarr)
stset syntax
stset timevar, failure(failvar )
timevar failvar
help stset
10.2.4 Kaplan-Meier
Cox Kaplan-Meier
t t
9.3 S (t)
Kaplan-Meier
Nt: t Et: t
t t h (t)
h (t) = Et Nt
(10.3)
t 1 − h (t)
t S (t − 1)
S (t) = [1 − h (t)] S (t − 1) (10.4)
t − 1 S (t − 1) = [1 − h (t − 1)] S (t − 2)
S (t) =
t
∏
k=1
[1 − h (k)] =
t
∏
k=1
( 1 − Ek
Nk
)
(10.5)
Kaplan-Meier
10.10 Kaplan-Meier
stset Kaplan-Meier
sts graph
by
sts graph, by(female)
sts graph, by(bc)
10.11
10.2.5 Cox
Cox stcox
10.12 Cox
Cox
stcox female high jrcol col other bc50-bc70
stcox exp (β)
1
1
β nohr
10.13
stcox high jrcol col other bc50-bc70 if female== 0 stcox high jrcol col other bc50-bc70 if female== 1
10.14
10.3 Stata
logit
stcox Cox
sts graph Kaplan-Meier stset
[1] (2007) KHPS 3
III pp.101-129.
[2] (1999)
pp.13-42.
[3] (2008)
[4] (2005) .
[5] (2009) .
[6] (2001) 490 .
[7] (2004) .
[8] (2008)
77 .
[9] C.R. McKenzie (2006)
II pp.129-151.
[10] (2007) Stata
.
[11] (2003)
No. 158
[12] (1991)
[13] (2006) .
[14] Colin R. McKenzie (2009) .
[15] (2007) KUMQRP Discussion Paper Series, DP2007-33.
[16] (2006)
II pp.153-167.
[17] (2001-02) (1)-(15) 52(9)-53(6).
[18] Baum, C.F. (2006), An Introduction to Modern Econometrics Using Stata, Stata Press.
[19] Bertrand, M, E. Duflo, and S. Mullainathan (2004) “How Much Should We Trust Differences-in- Differences Estimates,” Quarterly Journal of Economics, 119(1), pp.249-275.
[20] Cameron, A.C. and P.K. Trivedi (2005), Microeconometrics: Methods and Applications, Cambridge University Press.
[21] Cameron, A.C. and P.K. Trivedi (2008), Microeconometrics Using Stata, Stata Press.
[22] Cox, D.R. (1972) “Regression Models and Life Tables (with Discussion),” Journal of the Royal Statistical Society, B, 34, pp.187–220.
[23] Cox, D.R. (1975) “Partial Likelihood,” Biometrika, 62, pp.269–276.
[24] Heckman, J.J. (1979) “Sample Selection Bias as A Specification Error,” Econometrica, 47(1), pp.153- 62.
[25] Hsiao, C. (2002), Analysis of Panel Data, Cambridge University Press. , 2007
[26] Johnes, G. and Y. Tanaka (2008) “Changes in Gender Wage Discrimination in the 1990s: A Tale of Three Very Different Economies,” Japan and the World Economy, 20(1), pp.97-113.
[27] Mincer, J. (1962) “On-the-Job Training: Costs, Returns, and Some Implications,” Journal of Polit- ical Economy, 70, pp.50-79.
[28] Mincer, J. (1985) “Inter-Country Comparisons of Labor Force Trends and of Related Developments: An Overview,” Journal of Labor Economics, 3(1), pp.S1-S32.
[29] Miyoshi, K. (2008) “Male-Female Wage Differentials in Japan,” Japan and the World Economy, 20(4), pp.479-496.
[30] Neuman, S. and R.L. Oaxaca (2004) “Wage Decompositions with Selectivity-Corrected Wage Equa- tions: A Methodological Note,” Journal of Economic Inequality, 2, pp.3-10.
[31] Oaxaca, R.L. (1973) “Male-Female Wage Differentials in Urban Labor Markets,” International Eco- nomic Review, 14, pp.693-709.
[32] OECD ed. (2002) Employment Outlook, Paris: Organization for Economic Co-operation and Devel- opment.
[33] Wooldridge, J.M. (2001), Econometric Analysis of Cross Section and Panel Data, MIT Press. [34] Yamaguchi, K. (1991) Event History Analysis, Sage Publications, London.