# st: Murphy Topel with Probit/Multinomial Logit

 From Simone Boyce To Stata Subject st: Murphy Topel with Probit/Multinomial Logit Date Thu, 7 Apr 2005 11:31:01 -0700 (PDT)

```Hi,

I am running a two stage model, with a probit in the
first stage and a multinomial logit with three choices
in the second.  I would like to correct the var-cov
matrix using the Murphy-Topel estimator.  I wrote some
code using Greene's Economic Analysis (2003) as a
reference.  Is the below correct?

Thanks,
Simone Boyce

local sociodem male Dage2-Dage4 Drace2-Drace4
Dschool2-Dschool4 married Dp_income12-Dp_income14;

***************************************************************************************************
TWO STEP ESTIMATION WITH MURPHY TOPEL CORRECTION
***************************************************************************************************;
*Estimate first step: Probability of smoking;
gen smoke=CIGREC==1;
probit smoke `sociodem' Dpregnant, score(pscr);
predict phat;
matrix b1=e(b);
matrix V1=e(V);

*Estimate second step: Probability of smoking brand 1,
2 or 3;
mlogit pm_type `sociodem' phat [pweight=ANALWT_C],
score(mscr*);
matrix b2=e(b);
matrix list b2;
matrix V2=e(V);
predict mhat_1 mhat_2 mhat_3, p;
scalar N=_N;

********************
correct the standard errors using Murphy-Topel
correction (Greene (2003), p.510)
V = (1/n)*(V2 + V2*[C*V1*C' - R*V1*C' - C*V1*R']*V2
********************;
mkmat pscr, matrix(S1);
mkmat mscr*, matrix(S2);

*for the probit, calculate dln(L_probit)/db_probit;
matrix accum S1= `sociodem' [iweight=pscr];

*for mlogit, calculate dln(L_mlogit)/db_mlogit;
matrix accum S2= `sociodem' phat [iweight=mscr];

*calculate C=dln(L_mlogit)/dphat;
matrix
dL_dphat=((b2[1,15]-mhat_2)+(b2[1,31]-mhat_3))*S1;
matrix C=S2'*dL_dphat/N;
matrix R=S1'*S2/N;
matrix V=(V2+V2*(C*V1*C'-R*V1*C'-C*V1*R')*V2)/N;
matrix list V;

__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.