* use "C:\data\STATA\participation.dta", clear use "H:\Documents and Settings\Lee\My Documents\Document\stata\participation.dta", clear gen A2 = A*A gen one = 1 * Excersise 11.12 (w/o OPG based LM test) * generate the squared variables gen no2=no*no gen nu2=nu*nu * Restricted model quietly probit lfp I A A2 E F no nu, technique(nr) estimates store restrict * Unrestricted model quietly probit lfp I A A2 E F no no2 nu nu2, technique(nr) estimates store unrestrict estimates stats unrestrict restrict * Wald test of restrictions test nu2 no2 * The LR test for joint significance of the new variables lrtest restrict unrestrict * An equivalent test based on Hausman. Note: you have to * manually set the degrees of freedom for the pvalue. hausman unrestrict restrict, df(2) quietly probit lfp I A A2 E F no nu, technique(nr) predict index_r, xb predict prb, pr generate Ft = prb generate ft = normalden(index_r) /* variance */ gen vt = Ft*(1-Ft) * Transform variables for BRMR regression. * Notice that I divided by sqrt(vt). My previous advice * about using [aweight=1/vt] was not so good. gen ystar=(lfp-Ft)/sqrt(vt) gen Istar=ft*I/sqrt(vt) gen Astar=ft*A/sqrt(vt) gen A2star=ft*A2/sqrt(vt) gen Estar=ft*E/sqrt(vt) gen nustar=ft*nu/sqrt(vt) gen nostar=ft*no/sqrt(vt) gen Fstar=ft*F/sqrt(vt) gen nu2star=ft*nu2/sqrt(vt) gen no2star=ft*no2/sqrt(vt) gen cons = ft/sqrt(vt) /* BRMR */ quietly reg ystar cons Istar Astar A2star Estar nustar nostar Fstar nu2star no2star, noconst di "The BRMR test" scalar ess = e(mss) scalar pval = chi2tail(2,ess) scalar list ess pval * OPG regression to generate the LM test statistic drop index_r prb Ft ft vt Istar Astar A2star nostar nustar Fstar Estar ind nu2star no2star quietly probit lfp I A A2 E F no nu, technique(nr) predict index_r, xb predict prb, pr generate Ft = prb generate ft = normalden(index_r) /* variance */ gen vt = Ft*(1-Ft) gen ind=(lfp-Ft)*ft/vt gen Istar=ind*I gen Astar=ind*A gen A2star=ind*A2 gen Estar=ind*E gen nustar=ind*nu gen nostar=ind*no gen Fstar=ind*F gen nu2star=ind*nu2 gen no2star=ind*no2 /* OPGR */ quietly reg one ind Istar Astar A2star Estar nustar nostar no2star nu2star Fstar, noconst di "The LM test from the OPGR regression" scalar ess = e(mss) scalar pval = chi2tail(2,ess) scalar list ess pval