2 PC 2.1 PC 3 Stata ado Help Official Update Recommendation : compare these dates with what is available from update query curre

Similar documents
2 Tobin (1958) 2 limited dependent variables: LDV 2 corner solution 2 truncated censored x top coding censor from above censor from below 2 Heck

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model

80 X 1, X 2,, X n ( λ ) λ P(X = x) = f (x; λ) = λx e λ, x = 0, 1, 2, x! l(λ) = n f (x i ; λ) = i=1 i=1 n λ x i e λ i=1 x i! = λ n i=1 x i e nλ n i=1 x

最小2乗法

2 1,2, , 2 ( ) (1) (2) (3) (4) Cameron and Trivedi(1998) , (1987) (1982) Agresti(2003)

第13回:交差項を含む回帰・弾力性の推定

.. est table TwoSLS1 TwoSLS2 GMM het,b(%9.5f) se Variable TwoSLS1 TwoSLS2 GMM_het hi_empunion totchr

AR(1) y t = φy t 1 + ɛ t, ɛ t N(0, σ 2 ) 1. Mean of y t given y t 1, y t 2, E(y t y t 1, y t 2, ) = φy t 1 2. Variance of y t given y t 1, y t

(p.2 ( ) 1 2 ( ) Fisher, Ronald A.1932, 1971, 1973a, 1973b) treatment group controll group (error function) 2 (Legendre, Adrian


y i OLS [0, 1] OLS x i = (1, x 1,i,, x k,i ) β = (β 0, β 1,, β k ) G ( x i β) 1 G i 1 π i π i P {y i = 1 x i } = G (

第11回:線形回帰モデルのOLS推定


% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

4 OLS 4 OLS 4.1 nurseries dual c dual i = c + βnurseries i + ε i (1) 1. OLS Workfile Quick - Estimate Equation OK Equation specification dual c nurser

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

28

ECCS. ECCS,. ( 2. Mac Do-file Editor. Mac Do-file Editor Windows Do-file Editor Top Do-file e

1 4 1 ( ) ( ) ( ) ( ) () 1 4 2

k2 ( :35 ) ( k2) (GLM) web web 1 :

A B P (A B) = P (A)P (B) (3) A B A B P (B A) A B A B P (A B) = P (B A)P (A) (4) P (B A) = P (A B) P (A) (5) P (A B) P (B A) P (A B) A B P

1 I EViews View Proc Freeze

Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestim

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

JMP V4 による生存時間分析

!!! 2!

1 y x y = α + x β+ε (1) x y (2) x y (1) (2) (1) y (2) x y (1) (2) y x y ε x 12 x y 3 3 β x β x 1 1 β 3 1

わが国企業による資金調達方法の選択問題

4 2 p = p(t, g) (1) r = r(t, g) (2) p r t g p r dp dt = p dg t + p g (3) dt dr dt = r dg t + r g dt 3 p t p g dt p t r t = Benefit view dp

フィナンシャルレビュー 第80号

201711grade1ouyou.pdf

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F(

tokei01.dvi


Stata User Group Meeting in Kyoto / ( / ) Stata User Group Meeting in Kyoto / 21

Law and Economics Review vol.4,no.1(february 2009) 1998

seminar0220a.dvi

X X X Y R Y R Y R MCAR MAR MNAR Figure 1: MCAR, MAR, MNAR Y R X 1.2 Missing At Random (MAR) MAR MCAR MCAR Y X X Y MCAR 2 1 R X Y Table 1 3 IQ MCAR Y I

10:30 12:00 P.G. vs vs vs 2

Microsoft Word - 計量研修テキスト_第5版).doc

Ishi

Hsiao (2003, 6 ) Maddala, Li, Trost and Joutz (1997) Hsiao and Pesaran (2004) 4.2 y it = γy it 1 + x itβ + ε it i = 1, 2,..., N t = 1, 2,...T (

,, Poisson 3 3. t t y,, y n Nµ, σ 2 y i µ + ɛ i ɛ i N0, σ 2 E[y i ] µ * i y i x i y i α + βx i + ɛ i ɛ i N0, σ 2, α, β *3 y i E[y i ] α + βx i

kubostat2015e p.2 how to specify Poisson regression model, a GLM GLM how to specify model, a GLM GLM logistic probability distribution Poisson distrib

Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理

chap10.dvi

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

Preliminary Version Manning et al. (1986) Rand Health Insurance Experiment Manning et al. (1986) 3 Medicare Me

1 15 R Part : website:

solutionJIS.dvi

2 H23 BioS (i) data d1; input group patno t sex censor; cards;

9 1 (1) (2) (3) (4) (5) (1)-(5) (i) (i + 1) 4 (1) (2) (3) (4) (5) (1)-(2) (1)-(5) (5) 1

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

) ] [ h m x + y + + V x) φ = Eφ 1) z E = i h t 13) x << 1) N n n= = N N + 1) 14) N n n= = N N + 1)N + 1) 6 15) N n 3 n= = 1 4 N N + 1) 16) N n 4

untitled

J-LEAGUE 8000 V.Kawasaki Urawa.R 5000 J-LEAGUE

y = x 4 y = x 8 3 y = x 4 y = x 3. 4 f(x) = x y = f(x) 4 x =,, 3, 4, 5 5 f(x) f() = f() = 3 f(3) = 3 4 f(4) = 4 *3 S S = f() + f() + f(3) + f(4) () *4

「スウェーデン企業におけるワーク・ライフ・バランス調査 」報告書

5 Armitage x 1,, x n y i = 10x i + 3 y i = log x i {x i } {y i } 1.2 n i i x ij i j y ij, z ij i j 2 1 y = a x + b ( cm) x ij (i j )

ohpmain.dvi

..3. Ω, Ω F, P Ω, F, P ). ) F a) A, A,..., A i,... F A i F. b) A F A c F c) Ω F. ) A F A P A),. a) 0 P A) b) P Ω) c) [ ] A, A,..., A i,... F i j A i A

( 28 ) ( ) ( ) 0 This note is c 2016, 2017 by Setsuo Taniguchi. It may be used for personal or classroom purposes, but not for commercial purp

untitled

( )/2 hara/lectures/lectures-j.html 2, {H} {T } S = {H, T } {(H, H), (H, T )} {(H, T ), (T, T )} {(H, H), (T, T )} {1

untitled

カルマンフィルターによるベータ推定( )

29

コンピュータ概論

1 filename=mathformula tex 1 ax 2 + bx + c = 0, x = b ± b 2 4ac, (1.1) 2a x 1 + x 2 = b a, x 1x 2 = c a, (1.2) ax 2 + 2b x + c = 0, x = b ± b 2

waseda2010a-jukaiki1-main.dvi

ii 3.,. 4. F. ( ), ,,. 8.,. 1. (75% ) (25% ) =7 24, =7 25, =7 26 (. ). 1.,, ( ). 3.,...,.,.,.,.,. ( ) (1 2 )., ( ), 0., 1., 0,.

2 G(k) e ikx = (ik) n x n n! n=0 (k ) ( ) X n = ( i) n n k n G(k) k=0 F (k) ln G(k) = ln e ikx n κ n F (k) = F (k) (ik) n n= n! κ n κ n = ( i) n n k n

x T = (x 1,, x M ) x T x M K C 1,, C K 22 x w y 1: 2 2

LA-VAR Toda- Yamamoto(1995) VAR (Lag Augmented vector autoregressive model LA-VAR ) 2 2 Nordhaus(1975) 3 1 (D2)

Microsoft Word - 表紙.docx

1 Tokyo Daily Rainfall (mm) Days (mm)

講義のーと : データ解析のための統計モデリング. 第3回

ed srv.cc.hit-u.ac.jp

(1.2) T D = 0 T = D = 30 kn 1.2 (1.4) 2F W = 0 F = W/2 = 300 kn/2 = 150 kn 1.3 (1.9) R = W 1 + W 2 = = 1100 N. (1.9) W 2 b W 1 a = 0

橡同居選択における所得の影響(DP原稿).PDF

untitled

24 I ( ) 1. R 3 (i) C : x 2 + y 2 1 = 0 (ii) C : y = ± 1 x 2 ( 1 x 1) (iii) C : x = cos t, y = sin t (0 t 2π) 1.1. γ : [a, b] R n ; t γ(t) = (x

計量経済分析 2011 年度夏学期期末試験 担当 : 別所俊一郎 以下のすべてに答えなさい. 回答は日本語か英語でおこなうこと. 1. 次のそれぞれの記述が正しいかどうか判定し, 誤りである場合には理由, あるいはより適切な 記述はどのようなものかを述べなさい. (1) You have to wo

joho09.ppt

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or

ii 3.,. 4. F. (), ,,. 8.,. 1. (75%) (25%) =7 20, =7 21 (. ). 1.,, (). 3.,. 1. ().,.,.,.,.,. () (12 )., (), 0. 2., 1., 0,.

.3. (x, x = (, u = = 4 (, x x = 4 x, x 0 x = 0 x = 4 x.4. ( z + z = 8 z, z 0 (z, z = (0, 8, (,, (8, 0 3 (0, 8, (,, (8, 0 z = z 4 z (g f(x = g(

Solution Report

Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206,

1. A0 A B A0 A : A1,...,A5 B : B1,...,B

液晶の物理1:連続体理論(弾性,粘性)

³ÎΨÏÀ

ad bc A A A = ad bc ( d ) b c a n A n A n A A det A A ( ) a b A = c d det A = ad bc σ {,,,, n} {,,, } {,,, } {,,, } ( ) σ = σ() = σ() = n sign σ sign(

082_rev2_utf8.pdf

総合薬学講座 生物統計の基礎

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

12/1 ( ) GLM, R MCMC, WinBUGS 12/2 ( ) WinBUGS WinBUGS 12/2 ( ) : 12/3 ( ) :? ( :51 ) 2/ 71

確率論と統計学の資料


151021slide.dvi

Transcription:

Stata 1 Stata Stata web site 1 Stata is used by medical researchers, biostatisticians, epidemiologists, economists, sociologists, political scientists, geographers, psychologists, social scientists, and other research professionals needing to analyze data. Stata canned package Stata Stata TSP Rats SHAZAM E-views LIMDEP SPSS SAS Ox C Matlab GAUSS Ox C Matlab GAUSS TSP Rats E-views Stata Stata Stata Stata 2000 2 Stata ado web ado Stata ado Stata corp. Stata 1 http://www.stata.com/ 2 Stata 7 special edition 1

2 PC 2.1 PC 3 Stata ado Help Official Update Recommendation : compare these dates with what is available from http://www.stata.com/ update query currently installed last available 4 Recommendation wstata.exe ado ado Stata Corp. Stata ado ado Box-Cox ado ado Help STB and User-written programs ado ado ado help ado ado 3 4 02 5 Stata 6 2

2.2 Stata Stata Results Review Variables Stata Command Fonts Prefs Save Windowing preferences 3 Stata 3.1 Stata Results 3.2 Stata Command Stata Stata 3.3 Review Stata Command Stata Command 3

3.4 Variables Stata Command 4 5 4.1 Stata 3MB set mem 30m 30MB 4.2 Stata Results Open Log Append Overwrite Stata Results Stata Close log file 5 Stata Stata 4

6 4.3 set more off Stata Results -- more -- do 5 Stata Stata Stata Stata.dta 5.1 Stata Name Label Name 7 _all _b byte _coef _cons double float if in int long _n _N _pi _pred _rc _se _skip using with 6 7 Stata 7 5

Label Variables Name Label Label. 5.2 Data editor 5.3 Excel Excel Name Excel Data editor Edit Paste 5.4 insheet 5.5.dct infix using "C:\My Documents\sick.dct" infix dictionary using "C:\My Documents\sick.dat" { hhold 1-5... } sick.dat hhold 6

5.6 Label Name Label Label Data Editor Stata Variable Infomation Label Do label var hhold "Household ID" hhold Household ID 5.7 Stata Stata Name Label Stata Stata Stata Stata 3MB Stata set mem File Open 8 6 6.1 Help Stata Help Help Search 191 search 191 8 Do 7

6.2 Data Browser Data Editor Data Browser Data Browser Data Editor Data Browser Data Browser 6.3 Do Do Stata Do Do Stata Do file editor Do file editor Do Do Do Do Do Do /* */ Stata /* */ set mem 30m set more off /* Converting sick report to Stata format */ quietly infix using "C:\My Documents\2001\Ii\Intage\sicka.dct" save "C:\My Documents\2001\Ii\Intage\sicka.dta", replace /* generating data about 1st time to go to a doctor */ generate godoc1st = 1 if cope1n1 == 1 quietly replace godoc1st = d1d + 1 /* */ if cope1n1 ==. & cope2n1 == 1 8

7 9 7.1 describe codebook list inspect sum sum hosd1-hosd30 hosd1, hosd2,..., hosd30 centile table table tabulate correlate 7.2 drop table duration godoc1st if age >= 40 & duration < 11 age 40 duration 11 duration, godoc1st if == >= <= > < ~= & + - / * ^. 9 Help graph 9

if sum duration if sickname == 1 sum duration if sickname == 2... by gsort sickname by sickname : sum duration sickname by by 10 sum duration if age <= 9 & age >=0 sum duration if age <= 19 & age >=10... for for num 0/9 : sum duration if age <= X9 & age >=X0 X X 10 X, Y, Z by for for num 2/29 \ num 3/30 : gsort hosdcx \ by hosdcx : sum hosdy 10 10

gsort hosdc2 by hosdc2 : sum hosd3 gsort hosdc3 by hosdc3 : sum hosd4... gsort hosdc29 by hosdc29 : sum hosd30 by for 7.3 sum generate hosdc2 = hosd1 + hosd2 generate log generate egen egen max, min, sum, median [ n 1] 11 1 sort id time by id: generate dhos = hos[_n] + hos[_n-1] hos 1 id dhos sort id time by id: generate dhos = hos[_n+1] + hos[_n] 11 ts 11

replace generate avedoc = 0 if godoc1st ==. for num 2/30 : quietly replace avedoc = hosdcx / duration if duration == X quietly replace avedoc = 1 if duration == 1 & godoc1st == 1 avedoc godoc1st duration X X hosdcx duration generate inc700d = 1 if income >= 700 & income ~=. replace inc700d = 0 if income < 700 pref generate replace tabulate pref, generate(pref) pref1, pref2,... label pref == 1 7.4 Stata keep drop 12

keep if drop if keep drop 2 append merge using Stata append missing variable append using newdata using " merge merge recid using ds2 recid ds2 merge merge merge drop merge keep save use keep save use merge merge rename var 13

8 ttest, by(variables) Help search Reference Manual Reference Manual 8.1 OLS duration i = β 0 + β 1 gender + β 2 inc700d + ε i Gauss-Markov β 0,β 1,β 2 BLUE 1 1. y i = β 1 x i1 + β 2 x i2 + + β K x ik + ε i 2. E[ε i X] =E[ε i x 1,x 2,..., x n ]=0 3. n K K 4. E[ε 2 i x 1,x 2,..., x n ] = σ 2 > 0 (i =1, 2,..., n) E[ε i ε j x 1,x 2,..., x n ] = 0 (i j) OLS b =(X X) 1 X y β 1. unbiasedness 12 E[b X] =β 2. Var(b X) =σ 2 (X X) 1 12 14

3. BLUE : Best Linear Unbiased Estimator b efficient 4. cov(b, e X) =cov(b, (y Xb) X) =0 5. E[e e/(n K) X] =σ 2 OLS Stata OLS reg reg duration gender inc700d duration reg nocons reg duration gender inc700d, nocons White reg duration gender inc700d, robust Davidson and MacKinnon (1993, pp.554-556) 13 hc2 hc3 1 Cochrane-Orcutt prais corc 2 8.1.1 Gauss-Markov k 1 14 t Y 1 = β 1 + β 2 X 21 + β 3 X 31 + + β k X k1 + u 1 Y 2 = β 2 + β 2 X 22 + β 3 X 32 + + β k X k2 + u 2. (1). Y t = β 1 + β 2 X 2t + β 3 X 3t + + β k X kt + u t 13 Davidson, Russell and James G. MacKinnon. 1993. Estimation and Inference in Econometrics. Oxford University Press. 14 15

k Y 1 1 X 21 X 31 X k1 β 1 u 1 Y 2 y =., X = 1 X 22 X 32 X k2.......,β = β 2., u = u 2 (2). Y t 1 X 2t X 3t X kt β k u t y = Xβ + u (3) y t 1 X t k β k 1 u t 1 Xβ 15 t 1 1 Y 1 = β 1 + β 2 X 21 + β 3 X 31 + + β k X k1 + u 1 (4) 3 X u β u y 3 u β 2 u 2 β 3 2 u u = y Xβ (5) 2 [ u 2 1 + u2 2 + + u2 t = u u = ] u 1 u 2 u t u 1 u 2.. (6) u t 16 u u =(y Xβ) (y Xβ) (7) 15 3 16 u u T 16

17 u u =(y (Xβ) )(y Xβ) (8) 18 u u =(y β X )(y Xβ) (9) 19 u u = y y y Xβ β X y β X Xβ (10) 3 β X y u u = y y y Xβ y Xβ β X Xβ (11) 2 3 u u = y y 2y Xβ β X Xβ (12) β b e = y Xb e e β 2 b b b 20 b b f(x) (x 1,x 2,,x k ) 21 x =(x 1,x 2,,x k ) f x 1 f f x = x 2. f x k f(x) (x 1,x 2,,x k ) x 1 [ ] x 2 f(x) =a x = a 1 a 2 a k. x k 17 18 19 (a + b)(c + d) =ac + ad + bc + bd 20 21 (13) (14) 17

a 1 f x = a 2. = a (15) a k (a x) x = a (16) 2 A 22 (x Ax) x =2Ax (17) u u = y y 2y Xβ β X Xβ (18) β 2 b 23 (u u) b = 2y X +2X Xb = 0 (19) 2 X Xb = X y (20) b X Xb = X y (21) X X 1 X OLS X X OLS b =(X X) 1 X y (22) 22 X X X 23 18

OLS β b β =(X X) 1 X y β (23) y Xβ + u b β =(X X) 1 X (Xβ + u) β (24) b β =(X X) 1 (X X)β +(X X) 1 X u β (25) X 1 X = I b β = β +(X X) 1 X u β (26) b β =(X X) 1 X u (27) sampling error E[b β] =E[(X X) 1 X u] (28) 24 E[b] β =(X X) 1 X E[u] (29) u E[b] =β (30) OLS OLS b 25 var(b) = var(b β) (31) sampling error var(b) = var((x X) 1 X u) (32) A x var(ax) =Avar(x)A (33) 24 OLS b β 25 k k k 19

26 var(b) =(X X) 1 X var(u)((x X) 1 X ) (34) u var(u) =E(uu ) (35) var(b) =(X X) 1 X E(uu )((X X) 1 X ) (36) σ 2 var(b) =(X X) 1 X (σ 2 I n )((X X) 1 X ) (37) σ 2 var(b) =σ 2 (X X) 1 X ((X X) 1 X ) (38) 27 var(b) =σ 2 (X X) 1 X X(X X) 1 = σ 2 (X X) 1 (39) 2 OLS 3 OLS σ 2 (X X) 1 2 OLS Gauss-Markov OLS e OLS b 8.2 IV GMM: Generalized Method of Moments Hayashi 2000, pp.226-231 28 y i = δ 1 z 1i + δ 2 z 2i + + δ L z Li + ε i 26 2 27 (AB) 1 = B 1 A 1 ABB 1 A 1 = I 28 Hayashi, Fumio. 2000. Econometrics. Princeton University Press. 20

δ 1,δ 2,,δ L L z 1i,z 2i,,z Li ε i K x 1i,x 2i,,x Ki IV: Instrumental Variables x 1i 0 x 2i E. ε i = 0. x Ki 0 ε i ε i = y i δ 1 z 1i δ 2 z 2i δ L z Li x 1i 0 x 2i E. [y i δ 1 z 1i δ 2 z 2i δ L z Li ] = 0. x Ki 0 x 1i (y i δ 1 z 1i δ 2 z 2i δ L z Li ) x 2i (y i δ 1 z 1i δ 2 z 2i δ L z Li ) E.. x Ki (y i δ 1 z 1i δ 2 z 2i δ L z Li ) = 0 0.. 0 orthogonality condition x ki,z li,y i (δ 1,δ 2,,δ L ) L K = = K<L Not identified Just identified 1 Over identified Over identified GMM Hansen J Hansen s J-statistic Hayashi 2000, pp.217-218 specification test 1 GMM order condition IV OLS GMM OLS 21

29 excluded variables excluded restrictions OLS rank condition conditional homoskedasticity efficient GMM 2 2SLS Hayashi 2000. pp.226-231 2SLS OLS 1 ẑ li predicted values, fitted values 2 2 y i ẑ iˆδ yi z iˆδ 2SLS GMM 1 GMM 2SLS Stata ivreg ivreg ( = ) White OLS robust nocons 1 first 2SLS consistency finite-sample weak instruments ; Hayashi 2000, p.229, Staiger and Stock 1997 30 1 F R 2 ado GMM ivgmm0 ( = ) 8.3 Probit Stata 29 Wooldridge 2001, pp.49-51. simultaneity omitted variables measurement error 30 Staiger, D. and J. Stock. 1997. Instrumental variables regression with weak instruments. Econometrica 65, 557-586. 22

Yes No latent variable x i y i yi yi = β 0 + β 1 x i + ε i β 0,β 1 ε i N(0,σ 2 ) y i =1 y i =0 y > 0 y 0 P (y i =1) = Pr(y > 0) = Pr(β 0 + β 1 x i + ε i > 0) = Pr(ε i > (β 0 + β 1 x i )) (40) ε i N(0,σ 2 ) Φ(z) ( ) β0 + β 1 x i P (y i =1)=Pr(ε i <β 0 + β 1 x i )=Φ (41) σ P (y i =0) = Pr(y 0) = Pr(β 0 + β 1 x i + ε i 0) = Pr(ε i (β 0 + β 1 x i )) (42) ε i N(0,σ 2 ) P (y i =0) = Pr(ε i (β 0 + β 1 x i )) ( = Φ β ) ( ) 0 + β 1 x i β0 + β 1 x i =1 Φ σ σ (43) 23

L n [ ( )] y β0 + β 1 x [ ( )] i 1 y i β0 i + β 1 x i L = Φ 1 Φ σ σ i=1 n ( )] [ ( )] ln L = yi [Φ ln β0 + β 1 x i +(1 y i σ )ln β0 + β 1 x i 1 Φ σ i=1 b 0,b 1 σ σ =1 b 0,b 1 P (y i =1)=Φ(b 0 + b 1 x i ) b 0,b 1 1 P (y i =1) x x P (y i =1)=φ (b 0 + b 1 x) b 1 P (y i =1) 70 5 1 P (y i =1) 70 75 2 2 3 3 500 0 500 1000 1 1000 2 24

probit logit probit dprobit oprobit depvar variables 8.4 Heckman 2 Heckman 2 y i x i u i y i = β x i + u i y i π z i + ε i 0 z i π ε i ε i σε 2 u i σ uε ε i u i 2 ( ) [( ) ( )] ui 0 σ 2 = N, u σ uε. 0 ε i σ uε σ 2 ε y i Gauss-Markov E[y i x i,z i,π z i + ε i 0] = β x i + E[u i ε i π z i ] η i π z i + ε i 0 y i = β x i + E[u i ε i π z i ]+η i. E[u i ε i π z i ] ε i u i Choleski decomposition Greene 1997, p.44, p.179 ( ) ( )( ) σε 2 σ uε σ ε 0 σ ε σ uε /σ ε = σ uε σ uε /σ ε σ u 0 σ u σ 2 u 25

N(0, 1) x 1,x 2 ε i u i ( ) ( ) ( )( ε i 0 σ ε 0 = + u i 0 σ uε /σ ε σ u x 1 x 2 [ ] E[u i ε i π σ uε z i ] = E x 1 + σ u x 2 σ ε σ εx 1 π z i [ ] = σ uε σ ε E x 1 x 1 π z i σ ε ) ( ) σ ε x 1 = (σ uε /σ ε )x 1 + σ u x 2 φ( ) Φ( ) φ (m) = mφ(m), φ(m) =φ( m) E[u i ε i < π z i ] = σ uε σ ε π z i σε = σ uε σ ε 1 Φ(π z i /σ ε ) = σ uε σ ε 1 Φ(π z i /σ ε ) = σ uε σ ε 1 Φ(π z i /σ ε ) φ = λ φ (π z i /σ ε ) Φ(π z i /σ ε ) x 1 φ(x 1 ) 1 Φ( π z i /σ ε ) dx 1 π z i σε π z i σε ( π ) z i σ ε x 1 φ(x 1 ) dx 1 φ (x 1 ) dx 1 λ = σ uε /σ ε y i = β x i + λ φ (π z i /σ ε ) Φ(π z i /σ ε ) + η i η i well-behaved Heckman Heckit Probit π π φ(π z i /σ ε )/Φ(π z i /σ ε ) Inverse Mill s Ratio OLS Type 2 Tobit Type 5 Tobit Amemiya 1995 y i = β x i + u i β = β 1 if P i = π z i + ε i < 0 β = β 2 if P i = π z i + ε i 0 26

P i β switching regression P i self-selection model P i Heckman 2 heckman, select( ) x i z i heckman Heckman 2 twostep select( ) 8.5 31 random effect model xtdes, i( ) t( ) xtsum, i( ) t( ) xtreg depvar variables, fe i( ) xtreg depvar variables, re i( ) xthaus Hausman xtivreg 32 xtivreg strict exogeneity 33 xtivreg GLS random-effect model Between-effects 31 Stata 8 Reference Cross-Sectional Time-Series 32 Stata 8 33 Baltagi, Badi H. 2001. Econometric Analysis of Panel Data 2nd edition. John Wiley and Sons. Wooldridge, Jeffrey M. 2001. Econometric Analysis of Cross Section and Panel Data. MIT Press. 10 11 27

model Fixed-effects model First-differenced estimator 4 xtivreg ( = ), re be fe fd Firstdifferenced estimator xtreg i( ) First-differenced estimator tsset first 1 GLS random-effect model Baltagi EC2SLS Arellano and Bond (1991, RES) xtabond Amemiya and McCurdy (1986, Econometrica) Hausman and Taylor (1981, Econometrica) xthtaylor xtlogit xtprobit Stata 8 tsset 8.6 durac faildoc Stata stset durac, failure( faildoc) Cox stcox gender hcon2-hcon6 inc700d copay2-copay7 streg gender hcon2-hcon6 inc700d copay2-copay7, d(weibull) Kaplan-Meier sts graph sts graph, na 28

8.7 (1) (2) (3) (4) Density Estimation i.i.d., identically and independently distributed X f(x) f(x) smooth h>0 2h f(x) = x+h x h f(u) du = Pr(X [x h, x + h]) x f(x) 34 ˆf h (X) ˆf h (x) = 1 Pr(X [x h, x + h]) 2h Pr(X [x h, x+h]) X [x h, x+h] 2h [x h, x + h] N Indicator function I ˆf h (x) = 1 1 2h N = 1 N N I( X i x h) i=1 N 1 1 h 2 I( X i x /h 1) = 1 N i=1 N i=1 1 h K((x X i)/h) = 1 N N K h (x X i ) kernel K(u) = 1 2I( u 1) bindwidth h f(x) kernel density estimator kernel step function kernel [x h, x + h] x kernel window 34 i=1 29

function K kernel Gaussian kernel K(u) =(2π) 1/2 exp( u 2 /2) kernel piecewise continuous kernel K(u) K(u) =K( u), K(u) du =1 kdensity, kernel Kernel Gaussian kernel triangle kernel Kernel generate(, ) Regression Estimation 1 2 m(x) =E(Y X = x) (X, Y ) f(x, y) yf(x, y) dy m(x) =E(Y X = x) = f(x, y) dy kernel density estimator ˆf h (x, y) = 1 N K h (x X i )K h (y Y i ) N i=1 y kernel 1 N ˆf h (x, y) dy = K h (x X i )K h (y Y i ) dy N i=1 = 1 N K h (x X i ) K h (y Y i ) dy = 1 N N y ˆf h (x, y) dy = = 1 N i=1 1 N i=1 N Y i K h (x X i )K h (y Y i ) dy i=1 N K h (x X i )Y i K h (y Y i ) dy = 1 N 30 N K h (x X i ) i=1 N K h (x X i )Y i i=1

y 1 N ˆfh (x, y) dy ˆm h (x) = ˆfh (x, y) dy = N i=1 K h(x X i )Y i 1 N N i=1 K h(x X i ) Nadaraya-Watson kernel estimate Nadaraya-Watson kernel estimate kernreg Y X, bwidth( ) kercode( ) npoint( ) bwidth smoothing parameter kernel kercode kernel 1 7 npoint 9 t 9.1 Stata b[ ] b[ cons] generate, replace predicted value, fitted value predict, xb predict post estimation command stdp xb e(sample) 31

predict if e(sample), xb 9.2 F χ 2 Stata b[ ] hours i = β 0 + β 1 lnw i + β 2 asset i + ε i β 1 = β 2 Stata test test OLS F reg hours lnw asset test _b[lnw] = _b[asset] test _b[lnw] + _b[asset] = 1 display reg hours lnw asset display _b[lnw] + _b[asset] test _b[lnw] + _b[asset] = 1 accumulate β 1 =0.5 test _b[lnw] + _b[asset] = 1 test _b[lnw] = 0.5, accumulate 2 accumulate 32

9.3 test Non-Linear testnl test test testnl 1 1 + exp(β 0 /β 1 ) =0.3 display 1/[1+exp(_b[_cons]/_b[lnw])] testnl 1/[1+exp(_b[_cons]/_b[lnw])] =0.3 Wald 2 ( ) 10 2 10.1 2 2 2 program define end program define nl version 6.0 if " 1 " == "?" { global S_1 " " exit } replace 1 = end nl nl 33

( 1 α hours i = ɛ ln α w i ) + u i ɛ α w i hours i nlsbst program define nlsbst version 6.0 if " 1 " == "?" { global S_1 "alpha epsilon" global alpha = 0.001 global epsilon = 0.4 exit } replace 1 = -$epsilon * ln((1-$alpha)*w/$alpha) end nl sbst hours 2 replace $ 2 b[w] 10.2 Stata Stata random effect Stata lf, d0, d1, d2 4 lf lf 34

2 lf program define args lnf theta1 theta2... tempvar quietly replace lnf =... end ml model lf ( = )... ml check ml maximize lnf program quietly replace lnf = theta1, theta2,... theta $ML y1, $ML y2,... = Stata Gould and Sribney 1999, 27 35 Weibull ln f i =(t i exp(x i β)) exp(s) + d i (s x i β + (exp(s) 1)(ln t i x i β)) β Weibull s t i,d i x i β theta1 s theta2 t i d i Stata s exp(s) 35 Gould, William and William Sribney. 1999. Maximum likelihood estimation with STATA. Stata Press, Texas. 35

p 1 M ln t i x i β R Stata program define myweib version 6.0 args lnf theta1 theta2 tempvar p M R quietly generate double p = exp( theta2 ) quietly generate double M = ($ML_y1*exp(- theta1 ))^ p quietly generate double R = ln($ml_y1)- theta1 quietly replace lnf = - M +$ML_y2*( theta2 - theta1 +( p -1)* R ) end generate, replace quietly double t i time d i died x i age ml model lf myweib (time died = age) () 2 theta2 ml model lf myweib (timeeq: time died = age) (sigma: ) $ML y1, $ML y2,..., theta1, theta2,..., = ml model lf myweib (timeeq: time died = age, nocons) (sigma: ) ml check ml maximize 36

11 Stata Reference Manual 37