------------------------------------------------------------------------------- name: log: Z:\PUBLIC_web\Stataworkshops\logit dropped var bias.log log type: text opened on: 8 Nov 2015, 13:42:59 . postfile cbias rep vars b se z using coefbias.dta, replace . postfile mbias rep vars b se z using margbias.dta, replace . . quietly forvalues rep=1/5000 { . postclose cbias . postclose mbias . . use coefbias.dta, clear . *bysort vars: summarize . reshape wide b se z, i(rep) j(vars) (note: j = 1 2) Data long -> wide ----------------------------------------------------------------------------- Number of obs. 10000 -> 5000 Number of variables 5 -> 7 j variable (2 values) vars -> (dropped) xij variables: b -> b1 b2 se -> se1 se2 z -> z1 z2 ----------------------------------------------------------------------------- . gen db = b2-b1 . gen dse = se2-se1 . gen dz = z2-z1 . summarize Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- rep | 5,000 2500.5 1443.52 1 5000 b1 | 5,000 .6557227 .1066427 .3361693 1.118582 se1 | 5,000 .1059813 .0081153 .086372 .151637 z1 | 5,000 6.152198 .5874972 3.806832 7.65084 b2 | 5,000 1.02925 .1675778 .5009148 1.805948 -------------+--------------------------------------------------------- se2 | 5,000 .1619061 .0222817 .109161 .312039 z2 | 5,000 6.341192 .3521547 4.588768 7.331216 db | 5,000 .3735274 .124561 .019304 1.103417 dse | 5,000 .0559248 .0195515 .0132493 .1908531 dz | 5,000 .1889938 .363884 -1.21803 2.012389 . ttest db==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- db | 5,000 .3735274 .0017616 .124561 .370074 .3769809 ------------------------------------------------------------------------------ mean = mean(db) t = 212.0437 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . ttest dse==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- dse | 5,000 .0559248 .0002765 .0195515 .0553827 .0564669 ------------------------------------------------------------------------------ mean = mean(dse) t = 202.2593 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . ttest dz==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- dz | 5,000 .1889938 .0051461 .363884 .1789051 .1990824 ------------------------------------------------------------------------------ mean = mean(dz) t = 36.7257 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . . use margbias.dta, clear . *bysort vars: summarize . reshape wide b se z, i(rep) j(vars) (note: j = 1 2) Data long -> wide ----------------------------------------------------------------------------- Number of obs. 10000 -> 5000 Number of variables 5 -> 7 j variable (2 values) vars -> (dropped) xij variables: b -> b1 b2 se -> se1 se2 z -> z1 z2 ----------------------------------------------------------------------------- . gen db = b2-b1 . gen dse = se2-se1 . gen dz = z2-z1 . summarize Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- rep | 5,000 2500.5 1443.52 1 5000 b1 | 5,000 .1240755 .0116504 .0773826 .1617528 se1 | 5,000 .0115133 .0021208 .0042179 .0190671 z1 | 5,000 11.35138 3.298977 4.47475 32.87629 b2 | 5,000 .1277029 .0121091 .0810883 .1765156 -------------+--------------------------------------------------------- se2 | 5,000 .0103545 .0018329 .0030967 .016096 z2 | 5,000 12.88339 3.424793 5.661351 49.32135 db | 5,000 .0036274 .0113674 -.0377973 .0583662 dse | 5,000 -.0011588 .000971 -.0056551 .002936 dz | 5,000 1.532004 1.847572 -7.169043 22.98206 . ttest db==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- db | 5,000 .0036274 .0001608 .0113674 .0033123 .0039426 ------------------------------------------------------------------------------ mean = mean(db) t = 22.5644 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . ttest dse==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- dse | 5,000 -.0011588 .0000137 .000971 -.0011857 -.0011319 ------------------------------------------------------------------------------ mean = mean(dse) t = -84.3881 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000 . ttest dz==0 One-sample t test ------------------------------------------------------------------------------ Variable | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] ---------+-------------------------------------------------------------------- dz | 5,000 1.532004 .0261286 1.847572 1.480781 1.583228 ------------------------------------------------------------------------------ mean = mean(dz) t = 58.6332 Ho: mean = 0 degrees of freedom = 4999 Ha: mean < 0 Ha: mean != 0 Ha: mean > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . . log close name: log: Z:\PUBLIC_web\Stataworkshops\logit dropped var bias.log log type: text closed on: 8 Nov 2015, 13:58:23 -------------------------------------------------------------------------------