|
|
| |
| |
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
| |
| cap prog drop boot_ols |
| prog define boot_ols, eclass |
|
|
| syntax anything [if] [in] , REPName(string) REPPath(string) NUMreps(integer) [DOFirst(string)] [MAindata(string)] |
| marksample touse |
| preserve |
| set more off |
| |
| qui `anything' `if' |
| tempfile starthere |
| save `starthere' |
| mat beta= e(b) |
| local cols= colsof(beta) |
| local obs=e(N) |
| local dvar=e(depvar) |
| local rname: rowfullnames e(V) |
| local cname: colfullnames e(V) |
| mat reps=J(`numreps',`cols',.) |
| |
| local i=1 |
| while `i'<=`numreps' { |
| qui { |
| drop _all |
| use "`reppath'/`repname'`i'" |
| `dofirst' |
| `anything' `if' [`wt'] |
| mat reps[`i',1]=e(b) |
| } |
| di `i' |
| local ++i |
| } |
| |
| drop _all |
| svmat reps |
| mat accum var= * [iw=1/`numreps'], dev nocons |
| mat colnames var= `cname' |
| mat rownames var= `rname' |
| |
| |
| drop _all |
| use `starthere' |
| qui `anything' `if' |
| |
| ereturn repost b=beta V=var |
| ereturn display |
| restore |
| end |
|
|
|
|
|
|
| |
| |
| |
| cap prog drop docpat_theory_lso |
| prog define docpat_theory_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [LCONT(varlist)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) TESTOF(string) SIGNIFEVIDENCE(string) [PARTIAL(string)] |
| |
| qui { |
|
|
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "$\beta_P$: Patient Voucher" |
| la var doctor_voucher "$\beta_D$: Doctor Voucher" |
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| foreach out in `varlist' { |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' patient_voucher doctor_voucher (`lcont') `if', clu(`cluvar') partial(`partial') |
|
|
| test patient_voucher=doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV `combo' |
| |
| local sign = sign(_b[patient_voucher]-_b[doctor_voucher]) |
| local n1= 1-normal(`sign'*sqrt(r(chi2))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one "`combo'" |
| |
| local n1= normal(`sign'*sqrt(r(chi2))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one "`combo'" |
| |
| estadd local p_oneside `p_one' |
| |
| test patient_voucher=doctor_voucher=0 |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV0 `combo' |
|
|
| qui sum `out' if e(sample) & doctor_voucher+patient_voucher==0 |
|
|
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
| |
| tokenize `testof' |
| estadd local test_of "``outcount''" |
|
|
| tokenize `signifevidence' |
| estadd local signif_evidence "``outcount''" |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher doctor_voucher) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDV test_of signif_evidence space DV N, fmt(0 0 0 0 0 a3 a0) labels("\emph{P-values and theory-driven tests}" "\enspace $\beta_P=\beta_D$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "Mean (Control)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
| |
| |
| |
| |
| cap prog drop docpat_hettable_theory_lso |
| prog define docpat_hettable_theory_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] PATH(string) SETNAME(string) |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] [PARTIAL(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) TESTOFH(string) SIGNIFEVIDENCEH(string) TESTOFL(string) SIGNIFEVIDENCEL(string) |
| NUMreps(integer) DODO(string) LCONT(string) |
| |
| qui { |
|
|
| preserve |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher_high "$\delta_{PH}$: Patient Voucher $\times$ High Risk" |
| la var doctor_voucher_high "$\delta_{DH}$: Doctor Voucher $\times$ High Risk" |
| la var patient_voucher_low "$\delta_{PL}$: Patient Voucher $\times$ Low Risk" |
| la var doctor_voucher_low "$\delta_{DL}$: Doctor Voucher $\times$ Low Risk" |
| la var above_med_pos "$\theta$: High Malaria Risk" |
| local counter=1 |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| tempfile theuser |
| save `theuser' |
| foreach out in `varlist' { |
| drop _all |
| use `theuser' |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| |
| |
| pdslasso `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos (`lcont') `if', clu(`cluvar') partial(`partial') |
| local totcont= "`e(xselected)' `e(xpartial)'" |
|
|
| |
| |
| boot_ols reg `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos `totcont' `if', reppath(`path') repname(`setname') num(`numreps') dofirst(`dodo') |
| |
| |
| test patient_voucher_high = doctor_voucher_high |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVhigh `combo' |
| |
| local sign = sign(_b[patient_voucher_high]-_b[doctor_voucher_high]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
|
|
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_high "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_high "`combo'" |
| |
| test patient_voucher_low = doctor_voucher_low |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVlow `combo' |
| |
| local sign = sign(_b[patient_voucher_low]-_b[doctor_voucher_low]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_low "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_low "`combo'" |
|
|
| |
| qui sum `out' if e(sample) & doctor_voucher + patient_voucher ==0 & above_med_pos==0 |
| |
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
|
|
| tokenize `testofh' |
| estadd local test_of_h "``outcount''" |
|
|
| tokenize `signifevidenceh' |
| estadd local signif_evidence_h "``outcount''" |
|
|
| tokenize `testofl' |
| estadd local test_of_l "``outcount''" |
|
|
| tokenize `signifevidencel' |
| estadd local signif_evidence_l "``outcount''" |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDVhigh test_of_h signif_evidence_h space p_PVDVlow test_of_l signif_evidence_l space DV N, fmt(0 0 0 0 0 0 0 0 0 a2 a0) labels("\emph{P-values and theory-driven tests}" "\enspace $\delta_{PH}=\delta_{DH}$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "\enspace $\delta_{PL}=\delta_{DL}$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "Mean (Control, Low Risk)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| restore |
| end |
|
|
|
|
|
|
|
|
| |
| |
| |
| |
| cap prog drop docpat_het_theory_lso_simple |
| prog define docpat_het_theory_lso_simple |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] PATH(string) SETNAME(string) |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] [PARTIAL(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) |
| NUMreps(integer) DODO(string) LCONT(string) |
| |
| qui { |
|
|
| preserve |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher_high "$\delta_{PH}$: Patient Voucher $\times$ High Risk" |
| la var doctor_voucher_high "$\delta_{DH}$: Doctor Voucher $\times$ High Risk" |
| la var patient_voucher_low "$\delta_{PL}$: Patient Voucher $\times$ Low Risk" |
| la var doctor_voucher_low "$\delta_{DL}$: Doctor Voucher $\times$ Low Risk" |
| la var above_med_pos "$\theta$: High Malaria Risk" |
| local counter=1 |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| tempfile theuser |
| save `theuser' |
| foreach out in `varlist' { |
| drop _all |
| use `theuser' |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| |
| |
| pdslasso `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos (`lcont') `if', clu(`cluvar') partial(`partial') |
| local totcont= "`e(xselected)' `e(xpartial)'" |
|
|
| |
| |
| boot_ols reg `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos `totcont' `if', reppath(`path') repname(`setname') num(`numreps') dofirst(`dodo') |
| |
| |
| test patient_voucher_high = doctor_voucher_high |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVhigh `combo' |
| |
| local sign = sign(_b[patient_voucher_high]-_b[doctor_voucher_high]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
|
|
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_high "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_high "`combo'" |
| |
| test patient_voucher_low = doctor_voucher_low |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVlow `combo' |
| |
| local sign = sign(_b[patient_voucher_low]-_b[doctor_voucher_low]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_low "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_low "`combo'" |
|
|
| |
| qui sum `out' if e(sample) & doctor_voucher + patient_voucher ==0 & above_med_pos==0 |
| |
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
|
|
| tokenize `testofh' |
| estadd local test_of_h "``outcount''" |
|
|
| tokenize `signifevidenceh' |
| estadd local signif_evidence_h "``outcount''" |
|
|
| tokenize `testofl' |
| estadd local test_of_l "``outcount''" |
|
|
| tokenize `signifevidencel' |
| estadd local signif_evidence_l "``outcount''" |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDVhigh p_PVDVlow space DV N, fmt(0 0 0 0 a2 a0) labels("\emph{P-values}" "\enspace $\delta_{PH}=\delta_{DH}$" "\enspace $\delta_{PL}=\delta_{DL}$" " " "Mean (Control, Low Risk)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| restore |
| end |
|
|
|
|
|
|
| |
| |
| |
| |
| cap prog drop docpat_pantable_lso |
| prog define docpat_pantable_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) [PARTIAL(string)] NUMreps(integer) DODO(string) |
| SETname(string) PATH(string) LCONT(string) |
| |
| qui { |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "\enspace $\beta_P$: Patient Voucher" |
| la var doctor_voucher "\enspace $\beta_D$: Doctor Voucher" |
| la var patient_voucher_high "\enspace $\delta_{PH}$: Patient Voucher $\times$ High Risk" |
| la var doctor_voucher_high "\enspace $\delta_{DH}$: Doctor Voucher $\times$ High Risk" |
| la var patient_voucher_low "\enspace $\delta_{PL}$: Patient Voucher $\times$ Low Risk" |
| la var doctor_voucher_low "\enspace $\delta_{DL}$: Doctor Voucher $\times$ Low Risk" |
| la var above_med_pos "\enspace $\theta$: High Malaria Risk" |
|
|
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| tempfile startfile |
| save `startfile' |
| |
| foreach out in `varlist' { |
| |
| |
| local headz`counter' "\emph{Panel A. No Interactions}" |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' patient_voucher doctor_voucher (`lcont') `if', clu(`cluvar') partial(`partial') |
|
|
| test patient_voucher=doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV `combo' |
| |
| test patient_voucher=doctor_voucher=0 |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV0 `combo' |
| |
| qui sum `out' if e(sample) & infotreat==0 & treat_scheduled==1 |
| estadd scalar DV=r(mean) |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
|
|
| |
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
| drop _all |
| use `startfile' |
| |
| |
| local headz`counter' "\emph{Panel B. Interactions with Predicted Malaria Probability}" |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| |
| pdslasso `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos (`lcont') `if', clu(`cluvar') partial(`partial') |
| local totcont= "`e(xselected)' `e(xpartial)'" |
| |
| |
| boot_ols reg `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos `totcont' `if', reppath(`path') repname(`setname') num(`numreps') dofirst(`dodo') |
| |
| test patient_voucher_high = doctor_voucher_high |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVhigh `combo' |
|
|
|
|
| test patient_voucher_low = doctor_voucher_low |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVlow `combo' |
| |
| qui sum `out' if e(sample) & doctor_voucher + patient_voucher ==0 |
|
|
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
| |
| estadd local space="" |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher doctor_voucher) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDV p_PVDV0 , fmt( 0 0 0) labels("\emph{P-Values: Two-Sided Tests} \textcolor{white}{XXXXXXXXXXXXXXXXXX}" "\enspace $\beta_P=\beta_D$" "\enspace $\beta_P=\beta_D=0$")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule \multicolumn{`colcount'}{l}{`headz1'} \\") |
| |
| esttab `eststr2' using "`table'", append keep(patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos) |
| label noabbrev `type' nogaps nomtit nonum |
| stats(space p_PVDVhigh p_PVDVlow space DV N, fmt(0 0 0 0 a2 a0) |
| labels("\emph{P-values: Two-Sided Tests} \textcolor{white}{XXXXXXXXXXXXXXXXXX}" "\enspace $\delta_{PH}=\delta_{DH}$" "\enspace $\delta_{PL}=\delta_{DL}$" " " "Mean (Control)" "N")) |
| nonote eqlabels(none) star(* 0.10 ** 0.05 *** 0.01) `extrac2' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("{ \begin{tabular}{l*{8}{C{`widc'}}} \\ \multicolumn{`colcount'}{l}{`headz`q''} \\") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
|
|
| |
| |
| |
| cap prog drop docpat_p1_lso |
| prog define docpat_p1_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) [PARTIAL(string)] LCONT(string) |
| |
| qui { |
|
|
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "$\beta_P$: Patient Voucher" |
| la var doctor_voucher "$\beta_D$: Doctor Voucher" |
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
|
|
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' patient_voucher doctor_voucher (`lcont') `if', clu(`cluvar') partial(`partial') |
|
|
| test patient_voucher=doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV `combo' |
| |
| test patient_voucher=doctor_voucher=0 |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV0 `combo' |
|
|
| qui sum `out' if e(sample) & doctor_voucher+patient_voucher==0 |
|
|
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher doctor_voucher) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDV p_PVDV0 space DV N, fmt(0 0 0 0 a2 a0) labels("\emph{P-values}" "\enspace $\beta_P=\beta_D$" "\enspace $\beta_P=\beta_D=0$" " " "Mean (Control)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
| |
| |
| |
| cap prog drop docpat_pat_aux_lso |
| prog define docpat_pat_aux_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) [PARTIAL(string)] LCONT(string) |
| |
| qui { |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "\enspace Patient Voucher" |
| la var doctor_voucher "\enspace Doctor Voucher" |
| la var patient_info "\enspace Patient Information" |
| la var pat_infoXno_voucher "\enspace Patient Information $\times$ No Voucher" |
| la var pat_infoXdoc_voucher "\enspace Doctor Voucher $\times$ Patient Information" |
| la var pat_infoXpat_voucher "\enspace Patient Voucher $\times$ Patient Information" |
|
|
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
| |
| |
| local headz`counter' "\emph{Panel A. Overall Effects}" |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
|
|
| pdslasso `out' patient_info (`lcont') `if', clu(`cluvar') partial(`partial') |
| |
| qui sum `out' if e(sample) & patient_info==0 |
| local control_PI: display %10.3f `r(mean)' |
| estadd local control_PI `control_PI' |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
|
|
| |
| local headz`counter' "\emph{Panel B. By Voucher Treatment Group}" |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' patient_info patient_voucher doctor_voucher pat_infoXpat_voucher pat_infoXdoc_voucher ($date $patient) `if', clu(`cluvar') partial(`partial') |
| |
| test patient_voucher = doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_NoVPVDV `combo' |
| |
| qui sum `out' if e(sample) & patient_info +doctor_voucher + patient_voucher ==0 |
| estadd scalar noPInoVoucher=r(mean) |
| |
| estadd local space="" |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_info) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space control_PI, fmt( 0 0) labels(" " "\enspace Mean (No PI)\textcolor{white}{XXXXXXXXXXXXXXX}")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule \multicolumn{`colcount'}{l}{`headz1'} \\") |
| |
| esttab `eststr2' using "`table'", append keep(patient_info patient_voucher doctor_voucher pat_infoXpat_voucher pat_infoXdoc_voucher) |
| label noabbrev `type' nogaps nomtit nonum |
| stats(space p_NoVPVDV space noPInoVoucher N, fmt(0 0 0 a3 a0) |
| labels("\enspace \emph{P-Values}" "\enspace \enspace Patient Voucher=Doctor Voucher" " " "\enspace Mean (No PI, No Voucher)" "\enspace N")) |
| nonote eqlabels(none) star(* 0.10 ** 0.05 *** 0.01) `extrac2' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("{ \begin{tabular}{l*{8}{C{`widc'}}} \\ \multicolumn{`colcount'}{l}{`headz`q''} \\") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
|
|
| |
| |
| |
| cap prog drop docpat_pat_lso |
| prog define docpat_pat_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) [PARTIAL(string)] LCONT(string) |
| |
| qui { |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "\enspace Patient Voucher" |
| la var doctor_voucher "\enspace Doctor Voucher" |
| la var patient_info "\enspace Patient Information" |
| la var doctor_voucher_x_patient_info "\enspace Doctor Voucher $\times$ Patient Information" |
| la var patient_voucher_x_patient_info "\enspace Patient Voucher $\times$ Patient Information" |
|
|
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
|
|
| |
| local headz`counter' "\emph{Panel B. By Voucher Treatment Group}" |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' patient_info patient_voucher doctor_voucher patient_voucher_x_patient_info doctor_voucher_x_patient_info ($date $patient) `if', clu(`cluvar') partial(`partial') |
| |
| test patient_voucher = doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_NoVPVDV `combo' |
| |
| qui sum `out' if e(sample) & patient_info +doctor_voucher + patient_voucher ==0 |
| estadd scalar noPInoVoucher=r(mean) |
| |
| estadd local space="" |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| } |
| |
| esttab `eststr1' using "`table'", replace keep(patient_info patient_voucher doctor_voucher patient_voucher_x_patient_info doctor_voucher_x_patient_info ) |
| label noabbrev `type' nogaps nomtit nonum |
| stats(space noPInoVoucher N, fmt(0 a3 a0) |
| labels(" " "\enspace Mean (No PI, No Voucher)" "\enspace N")) |
| nonote eqlabels(none) star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[h!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
| |
| |
| |
| cap prog drop docpat_doc_lso |
| prog define docpat_doc_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) [PARTIAL(string)] LCONT(string) |
|
|
| qui { |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "\enspace Patient Voucher" |
| la var doctor_voucher "\enspace Doctor Voucher" |
| la var infotreat "\enspace Doctor Information" |
| la var doctor_voucher_x_doctor_info "\enspace Doctor Voucher $\times$ Doctor Information" |
| la var patient_voucher_x_doctor_info "\enspace Patient Voucher $\times$ Doctor Information" |
|
|
| local counter=1 |
|
|
| local varhead "" |
| local paren`counter' "" |
| foreach out in `varlist' { |
|
|
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| pdslasso `out' infotreat patient_voucher doctor_voucher patient_voucher_x_doctor_info doctor_voucher_x_doctor_info ($date $patient) `if', clu(`cluvar') partial(`partial') |
| |
| test patient_voucher = doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_NoVPVDV `combo' |
| |
| qui sum `out' if e(sample) & infotreat +doctor_voucher + patient_voucher ==0 |
| local noDInoVoucher: display %7.3f `r(mean)' |
| estadd local noDInoVoucher `noDInoVoucher' |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| } |
| local ++counter |
| |
| } |
| |
| esttab `eststr1' using "`table'", replace keep(infotreat patient_voucher doctor_voucher patient_voucher_x_doctor_info doctor_voucher_x_doctor_info) |
| label noabbrev `type' nogaps nomtit nonum |
| stats(space noDInoVoucher N, fmt(0 a3 a0) |
| labels(" " "\enspace Mean (No DI, No Voucher)" "\enspace N")) |
| nonote eqlabels(none) star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[h!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
|
|
| |
| |
| |
| cap prog drop docpat_p1_theory |
| prog define docpat_p1_theory |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [EXtra(varlist)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) TESTOF(string) SIGNIFEVIDENCE(string) |
| |
| qui { |
|
|
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher "$\beta_P$: Patient Voucher" |
| la var doctor_voucher "$\beta_D$: Doctor Voucher" |
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| foreach out in `varlist' { |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| reg `out' patient_voucher doctor_voucher `extra' `if', clu(`cluvar') |
|
|
| test patient_voucher=doctor_voucher |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV `combo' |
| |
| local sign = sign(_b[patient_voucher]-_b[doctor_voucher]) |
| local n1= ttail(r(df_r),`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one "`combo'" |
| |
| local n1= 1-ttail(r(df_r),`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one "`combo'" |
| |
| estadd local p_oneside `p_one' |
| |
| test patient_voucher=doctor_voucher=0 |
| local n1= r(p) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDV0 `combo' |
|
|
| qui sum `out' if e(sample) & doctor_voucher+patient_voucher==0 |
|
|
|
|
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
| |
| tokenize `testof' |
| estadd local test_of "``outcount''" |
|
|
| tokenize `signifevidence' |
| estadd local signif_evidence "``outcount''" |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher doctor_voucher) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDV test_of signif_evidence space DV N, fmt(0 0 0 0 0 a3 a0) labels("\emph{P-values and theory-driven tests}" "\enspace $\beta_P=\beta_D$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "Mean (Control)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| end |
|
|
|
|
|
|
|
|
| |
| |
| |
| cap prog drop docpat_hettable_theory |
| prog define docpat_hettable_theory |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [EXtra(varlist)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC(string)] [PARTIAL(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) TESTOFH(string) SIGNIFEVIDENCEH(string) TESTOFL(string) SIGNIFEVIDENCEL(string) |
| DODO(string) PATH(string) SETNAME(string) NUMReps(string) |
| |
| qui { |
|
|
| preserve |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
| |
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher_high "$\delta_{PH}$: Patient Voucher $\times$ High Risk" |
| la var doctor_voucher_high "$\delta_{DH}$: Doctor Voucher $\times$ High Risk" |
| la var patient_voucher_low "$\delta_{PL}$: Patient Voucher $\times$ Low Risk" |
| la var doctor_voucher_low "$\delta_{DL}$: Doctor Voucher $\times$ Low Risk" |
| la var above_med_pos "$\theta$: High Malaria Risk" |
| local counter=1 |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| tempfile theuser |
| save `theuser' |
| foreach out in `varlist' { |
| drop _all |
| use `theuser' |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| |
| boot_ols reg `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos `extrac' `if', reppath(`path') repname(`setname') num(`numreps') dofirst(`dodo') |
|
|
| |
| |
| test patient_voucher_high = doctor_voucher_high |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVhigh `combo' |
| |
| local sign = sign(_b[patient_voucher_high]-_b[doctor_voucher_high]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
|
|
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_high "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_high "`combo'" |
| |
| test patient_voucher_low = doctor_voucher_low |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVlow `combo' |
| |
| local sign = sign(_b[patient_voucher_low]-_b[doctor_voucher_low]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_low "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_low "`combo'" |
|
|
| |
| qui sum `out' if doctor_voucher + patient_voucher ==0 & above_med_pos==0 |
| |
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
| |
| tokenize `testofh' |
| estadd local test_of_h "``outcount''" |
| tokenize `signifevidenceh' |
| estadd local signif_evidence_h "``outcount''" |
| |
| tokenize `testofl' |
| estadd local test_of_l "``outcount''" |
| tokenize `signifevidencel' |
| estadd local signif_evidence_l "``outcount''" |
| |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDVhigh test_of_h signif_evidence_h space p_PVDVlow test_of_l signif_evidence_l space DV N, fmt(0 0 0 0 0 0 0 0 0 a2 a0) labels("\emph{P-values and theory-driven tests}" "\enspace $\delta_{PH}=\delta_{DH}$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "\enspace $\delta_{PL}=\delta_{DL}$" "\enspace Test for mechanism:" "\enspace Significant evidence of mechanism:" " " "Mean (Control, Low Risk)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
|
|
| restore |
| end |
|
|
| |
| |
| |
| cap prog drop docpat_hettable_lso |
| prog define docpat_hettable_lso |
| est clear |
| syntax varlist [if], TEXWID(string) [Table(string)] [TYPE(string)] [FOOTnote(string)] [PREHEAD1(string)] PATH(string) SETNAME(string) |
| [PREHEAD2(string)] [TITLE(string)] [LABel(string)] WIDC(string) [EXTRAC1(string)] [EXTRAC2(string)] [PARTIAL(string)] |
| [EXTRAHEAD(string)] [EXTRAVARHead(string)] CLUVar(string) |
| NUMreps(integer) DODO(string) LCONT(string) |
| |
| |
| qui { |
|
|
| preserve |
|
|
| local q= 2 |
| local colcount= wordcount("`varlist'")+1 |
| local seclast= `q'-1 |
|
|
| |
| local ester=1 |
| forval i=1/`q' { |
| local eststr`i' "" |
| } |
| |
| |
| la var patient_voucher_high "$\delta_{PH}$: Patient Voucher $\times$ High Risk" |
| la var doctor_voucher_high "$\delta_{DH}$: Doctor Voucher $\times$ High Risk" |
| la var patient_voucher_low "$\delta_{PL}$: Patient Voucher $\times$ Low Risk" |
| la var doctor_voucher_low "$\delta_{DL}$: Doctor Voucher $\times$ Low Risk" |
| la var above_med_pos "$\theta$: High Malaria Risk" |
| local counter=1 |
| |
| local varhead "" |
| local paren`counter' "" |
| local outcount=1 |
| tempfile theuser |
| save `theuser' |
| foreach out in `varlist' { |
| drop _all |
| use `theuser' |
| |
| |
| local labelq : variable label `out' |
| local varhead "`varhead'& `labelq'" |
| |
| |
| pdslasso `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos (`lcont') `if', clu(`cluvar') partial(`partial') |
| local totcont= "`e(xselected)' `e(xpartial)'" |
|
|
| |
| |
| boot_ols reg `out' patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos `totcont' `if', reppath(`path') repname(`setname') num(`numreps') dofirst(`dodo') |
| |
| |
| test patient_voucher_high = doctor_voucher_high |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVhigh `combo' |
| |
| local sign = sign(_b[patient_voucher_high]-_b[doctor_voucher_high]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
|
|
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_high "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_high "`combo'" |
| |
| test patient_voucher_low = doctor_voucher_low |
| local n1= 2*(1-normal(sqrt(r(F)))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| estadd local p_PVDVlow `combo' |
| |
| local sign = sign(_b[patient_voucher_low]-_b[doctor_voucher_low]) |
| local n1= 1-normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="ge" local p_one_low "`combo'" |
|
|
| local n1= normal(`sign'*sqrt(r(F))) |
| local star "" |
| if `n1'<=.01 local star "\sym{***}" |
| if `n1'>.01 & `n1'<=.05 local star "\sym{**}" |
| if `n1'>.05 & `n1'<=.1 local star "\sym{*}" |
| local n2 = trim("`: display %10.3f `n1''") |
| local combo "`n2'`star'" |
| tokenize `oneside' |
| if "``outcount''"=="le" local p_one_low "`combo'" |
|
|
| |
| qui sum `out' if e(sample) & doctor_voucher + patient_voucher ==0 & above_med_pos==0 |
| |
| local DV: display %7.3f `r(mean)' |
| estadd local DV `DV' |
|
|
| tokenize `testofhigh' |
| estadd local test_of_high "``outcount''" |
| tokenize `testoflow' |
| estadd local test_of_low "``outcount''" |
| estadd local p_one_high `p_one_high' |
| estadd local p_one_low `p_one_low' |
| |
| est store E`ester' |
| local eststr`counter' "`eststr`counter'' E`ester'" |
| local paren`counter' "`paren`counter'' & (`ester')" |
| local ++ester |
| local ++outcount |
| } |
| local ++counter |
| } |
| |
| esttab `eststr1' using "`table'", keep(patient_voucher_high doctor_voucher_high patient_voucher_low doctor_voucher_low above_med_pos) label noabbrev `type' replace nogaps nomtit nonum |
| stats(space p_PVDVhigh p_PVDVlow space DV N, fmt(0 0 0 0 a2 a0) labels("\emph{P-values}" "\enspace $\delta_{PH}=\delta_{DH}$" "\enspace $\delta_{PL}=\delta_{DL}$" " " "Mean (Control, Low Risk)" "N")) |
| nonote star(* 0.10 ** 0.05 *** 0.01) `extrac1' |
| b(a2) se(a2) noline subs("\beta\_" "\beta_") |
| prehead("\begin{table}[ht!] \begin{adjustbox}{max width=`texwid'\textwidth} \begin{threeparttable} \caption{`title'} \label{`label'} {\begin{tabular}{l*{`colcount'}{C{`widc'}}} \toprule \toprule `paren1' `extrahead' \\ `varhead' `extravarhead' \\ \toprule ") |
| postfoot(\hline \end{tabular} } \begin{tablenotes}[flushleft] \small \item `footnote' \end{tablenotes} \end{threeparttable} \end{adjustbox} \end{table}) |
| restore |
| end |
|
|