help blogit_2P clear insheet using mwf.raw, comma sort d z x // compute expected Phase One numbers from fixed Phase Two numbers and // expected proportions gen NN=nij/tau_ij qui summ NN if d==0 scalar N0=r(max) qui summ NN if d==1 scalar N1=r(max) drop NN gen Nij=N0*tau_ij if d==0 replace Nij=N1*tau_ij if d==1 // compute expected numbers by detailed exposure in Phase Two gen nijk=nij*pi_ijk list, noobs sepby(d) // fit ML estimate for the logistic regression of 2 phase data // using expected Phase One (Nij) and Phase Two (nijk) data blogit_2P d z Nij nijk x,design method(ML) // extract the (expected) coefficient and variance/covariance matrix mat b=e(b) mat cov=e(V) // extract the expected coefficient (exp(.6931474)=2) and its standard error for x scalar betaX=b[1,1] display "betaX=" %9.7f betaX scalar se_betaX=sqrt(cov[1,1]) display "standard error(betaX)=" %9.7f se_betaX // compute the power for a bilateral Wald test at the 5% level scalar power=100*normal(betaX/se_betaX-1.96) di "Power=" %4.1f power "%"