?*********************************************************************** ?*********************************************************************** ?*********************************************************************** ?*********************************************************************** ?======================================================================= ? I. Setup - Uses healthcare.lpj ?======================================================================= ?*********************************************************************** ?*********************************************************************** ?*********************************************************************** ?*********************************************************************** SETPANEL ; group = id ; pds = ti $ ti = the group size CREATE ; t = ndx(id,1) $ t = the within group index, 1,2,...,Ti CREATE ; yr= map(year) $ yr = a full sample sequence of integers ?======================================================================= ?======================================================================= ? Part 1. Robust covariance matrix ?======================================================================= Namelist ; X = One,age,educ,income,married,hhkids$ Probit ; Lhs = public ; Rhs = X ; Table = Pooled $ Probit ; Lhs = public ; Rhs = X ; Cluster = id ; Table = Cluster $ Maketable ; Pooled,Cluster ; StandardErrors $ ?======================================================================= ? Part 2 ?======================================================================= Probit ; Lhs = public ; Rhs = x ; RandomEffects ; Panel ; Table=REM; hpt=8 $ MakeTable ; Pooled,Cluster,REM ; Standard errors $ ?======================================================================= > Part 3. Conditional and unconditional estimators ?======================================================================= ? Full Sample, T = 1 - 7 LOGIT ; Lhs = Doctor ; Rhs = income,educ ; panel ; Table = Cond$ (Conditional) LOGIT ; Lhs = Doctor ; Rhs = income,educ ; panel ; Fixed ; Table = uncond $ (Unconditional) MAKETABLE ; Cond,Uncond $ ? Two period LOGIT ; if[Ti=2]; Lhs = Doctor ; Rhs = income,educ ; panel ; Table = Cond2$ (Conditional) LOGIT ; if[Ti=2]; Lhs = Doctor ; Rhs = income,educ ; panel; Fixed ; Table = uncond2 $ (Unconditional) MAKETABLE ; Cond2,Uncond2 $ ?======================================================================= Part 4. Hausman test for fixed effects ?======================================================================= Logit ; Lhs = Doctor ; Rhs = income,educ,hhkids ; panel $ Matrix ; bfe = B ; Vfe = VARB $ Logit ; Lhs = Doctor ; Rhs = income,educ,hhkids,one $ Matrix ; db = bfe - b(1:3) ; dV = Vfe - Varb(1:3,1:3) $ Matr;list ; root(dv) $ Matrix ; List ; Hausman = db'db $ Calc ; list ; ctb(.95,row(db))$ ?======================================================================= ? Part 5. Test for random effects ?======================================================================= Probit ; Lhs = Doctor ; Rhs = one,income,educ,hhkids ; Panel ; LMTest $ Calc ; Logl0 = logl $ Probit ; Lhs = Doctor ; Rhs = one,income,educ,hhkids ; par ; Panel ; Random ; Hpt=8 $ Calc ; Logl1 = logl ; list ; lrtest = 2*(logl1 - logl0) $ Calc ; k1=kreg+1 ; list ; Waldtest = b(k1)^2/varb(k1,k1) $ ?======================================================================= ? Part 6. Mundlak's approach. Correlated random effects ?======================================================================= Namelist ; xm = income,educ,hhkids $ ? This creates new variables that have nothing in them yet. These are placeholders. Namelist ; (new); xmbar = incbar,educbar,kidsbar $ ? This command computes group means of the variables in the namelist. Create ; xmbar=GroupMean (xm, Pds=ti) $ ? This is the basic random effects computation. Probit ; lhs = Doctor ; Rhs = one,xm ; panel ; Random ; hpt=8 $ Calc ; logl0 = logl ; rho0=rho $ Matrix ; beta0 = b $ ? Compute the LM statistic at the starting values, which are zero for the group means. Probit ; lhs = Doctor ; Rhs = one,xm,xmbar ; Random ; panel ; hpt=8 ; start=beta0,0,0,0,rho0 ; lmtest $ ? This command requests the Wald statistic for the test. Probit ; lhs = Doctor ; Rhs = one,xm,xmbar ; Random ; panel ; hpt=8 ; test: xmbar $ Calc ; logl1 = logl ; List ; LRstat = 2*(logl1 - logl0) $ ?======================================================================= ? Part 7. Random effects as random parameter (random constant) ?======================================================================= Namelist ; X = income,educ,hhkids,one $ Probit ; if[Ti = 7] ; lhs = hospital ; Rhs = x ; panel ; random effects ; Hpt = 8 $ Calc ; RhoRE = Rho ; LogLRE = logL$ Probit ; if[Ti = 7] ; lhs = hospital ; Rhs = x ; panel ; RPM ; Fcn=One(n) ; Pts = 20 $ Calc ; K1 = Col(X) + 1 ; LogLRP = logL $ Calc ; SigmaRP = B(K1) ; List ; rhoRE ; RhoRP = SigmaRP^2/(1+SigmaRP^2) ; LogLRE ; LogLRP$ ?======================================================================= ? Part 8. Fixed effects Namelist ; x = income,educ,hhkids $ Logit ; if[Ti = 7] ;lhs = doctor ; Rhs = x,one ; random ; panel ; hpt=8 ; Table = REM $ Logit ; if[Ti = 7] ;lhs = hospital ; Rhs = x ; panel ; Table = FEMCond$ Logit ; if[Ti = 7] ;lhs = hospital ; Rhs = x ; panel ; FEM ; Table = FEM $ Maketable ; REM,FEM,FEMCond $ ?======================================================================= ? Part 9. Dynamic Probit Model. ?======================================================================= Sample ; all $ Setpanel ; group = id ; pds = ti $ ti = the group size Create ; yr = map(year) $ Namelist ; xit = age,income,hhkids,hsat,married $ Namelist ; (new) ; xbar = agebar,incbar,kidsbar,hsatbar,marrbar $ Create ; xbar = GroupMean(xit,Pds=ti) $ Create ; yi0 = Group obs1(public,pds=ti) $ Create ; ylag = public[-1] $ Probit ; if[ti = 7 & yr > 1 ] ; Lhs = public ; Rhs = one,xit,xbar,yi0,ylag ; Maxit = 10 ; Panel ; RPM ; Fcn=one(n) ; Pts=25 ; Halton $ dsta;rhs=xbar$