/*
Stata DO File
Author: Jeanette Bailey
Purpose: ComPAS RCT final analysis
*/
*This do file is the analysis for the main paper; for sharing on Data Repository
/*Section 1: Analyze Data*/
*INTENTION TO TREAT ANALYSES (make these categories mutually exclusive )
******Ranking system: Died>Nonresponse>Recovered>Transfer>Early Discharge>Defaulter
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
***It is necessary to drop the kids without adm forms (i.e., if adm_date==.) because nonresponse outcome cannot be determined.
*Children from War Malual and Lieth (warmalual==1 and early_cure_discharge==1) are kept in the ITT analyses- they are all counted as defaulters.
drop if adm_date==.
generate outcome_itt= "unknown"
replace outcome_itt= "died" if died==1
replace outcome_itt= "nonresponse" if nonresponse==1 & died==0
replace outcome_itt= "recovered" if recovered==1 & died==0 & nonresponse==0
replace outcome_itt= "transferred_sc" if transferred_sc==1 & died==0 & recovered==0 & nonresponse==0
replace outcome_itt= "transferred_new" if transferred_new==1 & died==0 & recovered==0 & nonresponse==0
replace outcome_itt= "defaulter" if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
replace outcome_itt= "early discharge" if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
replace outcome_itt= "early discharge" if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
tab outcome_itt intervention, column chi
***RECOVERY (ITT):
*make recovery binary for the clchi2 test:
**per ranking system, recovered = yes/no needs to account for (1) died and (2) nonresponse definition
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Recovery Risk ratio:
binreg recovered i.intervention, vce(cluster site_enc) rr
*Recovery odds ratio (unadjusted):
binreg recovered i.intervention, vce(cluster site_enc) or base
*Recovery odds ratio (adjusted):
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***DIED (ITT)
*binary died clchi analysis:
tab died intervention, col chi
clchi2 died intervention, cluster(site_enc)
* Died Risk Difference (unadjusted)
binreg died i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic died i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Died Risk Difference (adjusted)
binreg died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Died odds ratio (unadjusted):
binreg died i.intervention, vce(cluster site_enc) or base
*Died odds ratio (adjusted):
binreg died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***NON-RESPONSE (ITT):
*make sure nonresponse is mutually exclusive and binary:
replace nonresponse=0 if died==1
*binary non-response clchi analysis:
tab nonresponse intervention, col chi
clchi2 nonresponse intervention, cluster(site_enc)
* Non-response Risk Difference (unadjusted)
binreg nonresponse i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic nonresponse i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Non-response Risk Difference (adjusted)
binreg nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Non-response odds ratio (unadjusted):
binreg nonresponse i.intervention, vce(cluster site_enc) or base
*Non-response odds ratio (adjusted):
binreg nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***DEFAULTER (ITT):
*make sure defaulter is mutually exclusive and binary:
replace defaulter=0 if died==1
replace defaulter=0 if nonresponse==1
replace defaulter=0 if recovered==1
replace defaulter=0 if transferred==1
replace defaulter=0 if early_cured_discharge==1
replace defaulter=0 if early_nonresponse_discharge==1
*binary defaulter clchi analysis:
tab defaulter intervention, col chi
clchi2 defaulter intervention, cluster(site_enc)
*Defaulter Risk Difference (unadjusted)
binreg defaulter i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic defaulter i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Defaulter Risk Difference (adjusted)
binreg defaulter i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic defaulter i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Defaulter odds ratio (unadjusted):
binreg defaulter i.intervention, vce(cluster site_enc) or base
*Defaulter odds ratio (adjusted):
binreg defaulter i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***TRANSFERRED (ITT):
*make sure transferred is mutually exclusive and binary:
replace transferred=0 if died==1
replace transferred=0 if nonresponse==1
replace transferred=0 if recovered==1
*binary transferred clchi analysis:
tab transferred intervention, col chi
clchi2 transferred intervention, cluster(site_enc)
*Transferred Risk Difference (unadjusted)
binreg transferred i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic transferred i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Transferred Risk Difference (adjusted)
binreg transferred i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic transferred i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Transferred odds ratio (unadjusted):
binreg transferred i.intervention, vce(cluster site_enc) or base
*Transferred odds ratio (adjusted):
binreg transferred i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***TRANSFERRED-SC (ITT):
*make sure transferred_sc is mutually exclusive and binary:
replace transferred_sc=0 if died==1
replace transferred_sc=0 if nonresponse==1
replace transferred_sc=0 if recovered==1
*binary transferred_sc clchi analysis:
tab transferred_sc intervention, col chi
clchi2 transferred_sc intervention, cluster(site_enc)
*Transferred_sc Risk Difference (unadjusted)
binreg transferred_sc i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic transferred_sc i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Transferred_sc Risk Difference (adjusted)
binreg transferred_sc i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic transferred_sc i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Transferred_sc odds ratio (unadjusted):
binreg transferred_sc i.intervention, vce(cluster site_enc) or base
*Transferred_sc odds ratio (adjusted):
binreg transferred_sc i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***TRANSFERRED-NEW (ITT):
*make sure transferred_new is mutually exclusive and binary:
replace transferred_new=0 if died==1
replace transferred_new=0 if nonresponse==1
replace transferred_new=0 if recovered==1
*binary transferred_new clchi analysis:
tab transferred_new intervention, col chi
clchi2 transferred_new intervention, cluster(site_enc)
*Transferred_new Risk Difference (unadjusted)
binreg transferred_new i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*this way is better:
logistic transferred_new i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Transferred_new Risk Difference (adjusted)
binreg transferred_new i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*this way is better:
logistic transferred_new i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Transferred_new odds ratio (unadjusted):
binreg transferred_new i.intervention, vce(cluster site_enc) or base
*Transferred_new odds ratio (adjusted):
binreg transferred_new i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***EARLY DISCHARGE (ITT):
*first collapse early_cured_discharge and early_nonresponse_discharge into one category:
generate early_discharge=0
replace early_discharge=1 if early_cured_discharge==1
replace early_discharge=1 if early_nonresponse_discharge==1
*make sure early_discharge is mutually exclusive and binary:
replace early_discharge=0 if died==1
replace early_discharge=0 if nonresponse==1
replace early_discharge=0 if recovered==1
replace early_discharge=0 if transferred==1
*binary early_discharge clchi analysis:
tab early_discharge intervention, col chi
clchi2 early_discharge intervention, cluster(site_enc)
*Early discharge Risk Difference (unadjusted)
binreg early_discharge i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*this will work better:
logistic early_discharge i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Early discharge Risk Difference (adjusted)
binreg early_discharge i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*this will work better:
logistic early_discharge i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Early_discharge odds ratio (unadjusted):
binreg early_discharge i.intervention, vce(cluster site_enc) or base
*Early_discharge odds ratio (adjusted):
binreg early_discharge i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
*SAM & MAM-only ITT ANALYSES:
*SAM-only ITT:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*MAM-only ITT:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if SAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*<24 months analysis:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc>=24
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*>=24 months analysis:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*SAM & >=24 months (older SAM children):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*Larger SAM children (SAM and >=8kg):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if adm_weight<8
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*Older, larger children (>=24 months and >=8kg on admission):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if adm_weight<8
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*Older, larger SAM children (>=24 months and >=8kg on admission):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if adm_weight<8
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
clttest recovered, by(intervention) cluster(site_enc)
*PER PROTOCOL ANALYSES
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
generate outcome_pp= ""
replace outcome_pp= "died" if died==1
replace outcome_pp= "nonresponse" if nonresponse==1 & died==0
replace outcome_pp= "recovered" if recovered==1 & nonresponse==0 & died==0
tab outcome_pp intervention, column chi
***RECOVERED (PP)
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
**Recovery odds ratio (unadjusted):
binreg recovered i.intervention, vce(cluster site_enc) or base
*Recovery odds ratio (adjusted):
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Risk ratio:
binreg recovered i.intervention, vce(cluster site_enc) rr
***DIED (PP)
*binary died clchi analysis:
tab died intervention, col chi
clchi2 died intervention, cluster(site_enc)
*Died Risk Difference (unadjusted)
binreg died i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*this will work better:
logistic died i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Died Risk Difference (adjusted)
binreg died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*this will work better:
logistic died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Died odds ratio (unadjusted):
binreg died i.intervention, vce(cluster site_enc) or base
*Died odds ratio (adjusted):
binreg died i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
***NON-RESPONSE (PP):
*make sure nonresponse is mutually exclusive and binary:
replace nonresponse=0 if died==1
*binary non-response clchi analysis:
tab nonresponse intervention, col chi
clchi2 nonresponse intervention, cluster(site_enc)
*Nonresponse Risk Difference (unadjusted)
binreg nonresponse i.intervention, vce(cluster site_enc) rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*this will work better:
logistic nonresponse i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Nonresponse Risk Difference (adjusted)
binreg nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*this will work better:
logistic nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Non-response odds ratio (unadjusted):
binreg nonresponse i.intervention, vce(cluster site_enc) or base
*Non-response odds ratio (adjusted):
binreg nonresponse i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) or base
*SAM & MAM-only analyses:
*SAM-only recovery (per protocol):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if MAM==1
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*MAM-only analyses
*MAM-only recovery (per protocol):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if SAM==1
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*<24 months analysis:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if child_age_months_calc>=24
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*>=24 months analysis:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if child_age_months_calc<24
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*SAM & >=24 months (older SAM children):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
*Older, larger children (>=24 months and >=8kg on admission):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if adm_weight<8
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
*Larger SAM children (SAM and >=8kg):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if adm_weight<8
drop if MAM==1
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*Older, larger SAM children (>=24 months and >=8kg on admission):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if child_age_months_calc<24
drop if adm_weight<8
drop if MAM==1
tab recovered intervention, col chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
*PER PROTOCOL RECOVERY IN KENYA
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if country==2
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*PER PROTOCOL RECOVERY IN SOUTH SUDAN
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if country==1
*Make recovered binary and mutually exclusive:
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
tab recovered intervention, column chi
encode site, generate(site_enc)
clchi2 recovered intervention, cluster(site_enc)
* Recovery Risk Difference (unadjusted)
binreg recovered i.intervention, vce(cluster site_enc) base rd // vce(cluster... specifies the cluster variable, rd asks for risk difference
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*The first of the last three lines above fits a logistic regression model. The second estimates the average risks within intervention groups. The third line calculates the risk difference.
*Recovery Risk Difference (adjusted)
binreg recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc) rd
*The above binreg code is equivalent to the below code, which will work better under certain circumstances:
logistic recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site) base
margins intervention, post
nlcom (rd: _b[1.intervention] - _b[0.intervention]), post
*LENGTH OF STAY FOR RECOVERED CHILDREN
***select only those with a 'recovered outcome'
*PER PROTOCOL LENGTH OF STAY FOR ALL RECOVERED CHILDREN
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered intervention
generate los_recovered=.
replace los_recovered=lfu_date-adm_date+1
tabstat los_recovered, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest los_recovered, by(intervention) cluster(site_enc)
*LOS_Recovered Mean Difference unadjusted:
regress los_recovered i.intervention, vce(cluster site_enc) base
*LOS_Recovered Mean difference adjusted for age, sex and country:
regress los_recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*INTENTION TO TREAT LENGTH OF STAY FOR ALL RECOVERED CHILDREN
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered
generate los_recovered=.
replace los_recovered=lfu_date-adm_date+1
tabstat los_recovered, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest los_recovered, by(intervention) cluster(site_enc)
*LOS_Recovered Mean Difference unadjusted:
regress los_recovered i.intervention, vce(cluster site_enc) base
*LOS_Recovered Mean difference adjusted for age, sex and country:
regress los_recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*LENGTH OF STAY IN KENYA (PP):
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if country==2
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered
generate los_recovered=.
replace los_recovered=lfu_date-adm_date+1
tabstat los_recovered, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest los_recovered, by(intervention) cluster(site_enc)
*LOS_Recovered Mean Difference unadjusted:
regress los_recovered i.intervention, vce(cluster site_enc) base
*LOS_Recovered Mean difference adjusted for age, sex and country:
regress los_recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*LENGTH OF STAY IN SOUTH SUDAN (PP)
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
drop if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
drop if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
drop if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
drop if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
drop if country==1
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered
generate los_recovered=.
replace los_recovered=lfu_date-adm_date+1
tabstat los_recovered, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest los_recovered, by(intervention) cluster(site_enc)
*LOS_Recovered Mean Difference unadjusted:
regress los_recovered i.intervention, vce(cluster site_enc) base
*LOS_Recovered Mean difference adjusted for age, sex and country:
regress los_recovered i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*AVERAGE WEIGHT AND MUAC GAIN PER DAY (do this only for recovered patients, per global standards as outlined in CMAM Report):
***select only those with a recovered outcome
***weights are in kg, so weight gain in kg per day needs to be converted to g per day.
*PER PROTOCOL AVG WEIGHT AND MUAC GAINS PER DAY:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered intervention
drop if adm_weight==.
*dropping oedema cases because we do not use the same parameters for assessing weight gain in these children (need mininum weight instead of admission weight)- this was discussed with Charles and Marko and decided not to keep oedema in weight gain analyses
drop if adm_oedema==1
drop if lfu_oedema==1
***Note: not including slfu_oedema in this because only adm_oedema and lfu_oedema are used to assess weight gain, and as long as oedema has resolved weight gain analyses should be accurate.
generate adm_weight_g=.
replace adm_weight_g=adm_weight*1000
*converts adm_weight in kg to weight in grams
generate lfu_weight_g=.
replace lfu_weight_g=lfu_weight*1000
*converts lfu_weight in kg to weight in grams
***Total weight gain (g)
generate total_weight_gain=.
replace total_weight_gain= lfu_weight_g-adm_weight_g
tabstat total_weight_gain, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest total_weight_gain, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress total_weight_gain i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress total_weight_gain i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
tabstat total_weight_gain, stats (n mean semean) by(intervention)
browse if total_weight_gain<0
***there are 44 cases of children who slightly lost weight - most were admitted with muacs near 12, came for a few visits, achieved discharge criteria per muac but lost some weight.
*Keep those who lost weight in the analyses- doesn't matter what direction weight gain went in.
***Avg weight gain (g/kg/day)
*Notes from CMAM Report: Formula of Individual and Average Weight Gain (AWG)
*Weight gain is calculated as the difference in weight on day of entry to the programme until discharge from the programme for recovered beneficiaries one by one (in gram/kg/day):
//Individual weight gain = [W 2 - W1 / W] / T (in gram/kg/day)
//W = Weight in kg on the day of entry to the programme (for Kwashiorkor cases day of minimum weight)
//W1 = Weight in grams on day of entry to the programme (for Kwashiorkor cases day of minimum weight)
//W2 = Weight in grams the day of discharge from the programme
//T = Number of days elapsed between W1 and W2
*Subsequently, the average out of these individual weight gains will be calculated:
*Average weight gain = Sum of individual weight gains (gram/kg/day) / Total number of beneficiaries
generate g_kg_day=.
replace g_kg_day=(total_weight_gain/adm_weight)/los
*lfu weight in g minus adm weight in g, divided by adm weight in kg, divided by los in days
*check for implausible avg weight gains (g/kg/day), defined as a change in either direction of more than 25 g/kg/day:
///n=0
replace implausible_value=1 if g_kg_day>25 & g_kg_day !=.
replace implausible_value=1 if g_kg_day<-25 & g_kg_day !=.
tabstat g_kg_day, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest g_kg_day, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress g_kg_day i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress g_kg_day i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*MUAC gain (total and mm/day) (select only those with a recovered outcome)
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered intervention
drop if adm_muac==.
***Total MUAC gain (mm)
generate total_cm_gain=.
replace total_cm_gain= lfu_muac- adm_muac
generate total_mm_gain=.
replace total_mm_gain=total_cm_gain*10
browse if total_cm_gain<0
tabstat total_mm_gain, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest total_mm_gain, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress total_mm_gain i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress total_mm_gain i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
***MUAC gain/day (mm/day)
generate mm_day=.
replace mm_day=total_mm_gain/los
*check for implausible muac gains (defined as a muac change in either direction of more than 15mm/week, or 2.14mm/day):
///n=0
replace implausible_value=1 if mm_day>2.14 & mm_day !=.
replace implausible_value=1 if mm_day<-2.14 & mm_day !=.
tabstat mm_day, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest mm_day, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress mm_day i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress mm_day i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
*INTENTION TO TREAT AVG WEIGHT AND MUAC GAINS PER DAY:
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
tab recovered
drop if adm_weight==.
*dropping oedema cases because we do not use the same parameters for assessing weight gain in these children (need mininum weight instead of admission weight)- this was discussed with Charles and Marko and decided not to keep oedema in weight gain analyses
drop if adm_oedema==1
drop if lfu_oedema==1
***Note: not including slfu_oedema in this because only adm_oedema and lfu_oedema are used to assess weight gain, and as long as oedema has resolved weight gain analyses should be accurate.
generate adm_weight_g=.
replace adm_weight_g=adm_weight*1000
*converts adm_weight in kg to weight in grams
generate lfu_weight_g=.
replace lfu_weight_g=lfu_weight*1000
*converts lfu_weight in kg to weight in grams
***Total weight gain (g)
generate total_weight_gain=.
replace total_weight_gain= lfu_weight_g-adm_weight_g
tabstat total_weight_gain, stats (n mean semean) by(intervention)
*added to adjust SE for clustering:
encode site, generate(site_enc)
clttest total_weight_gain, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress total_weight_gain i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress total_weight_gain i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
tabstat total_weight_gain, stats (n mean semean) by(intervention)
browse if total_weight_gain<0
***there are 44 cases of children who slightly lost weight - most were admitted with muacs near 12, came for a few visits, achieved discharge criteria per muac but lost some weight.
*Keep those who lost weight in the analyses- doesn't matter what direction weight gain went in.
***Avg weight gain (g/kg/day)
*Notes from CMAM Report: Formula of Individual and Average Weight Gain (AWG)
*Weight gain is calculated as the difference in weight on day of entry to the programme until discharge from the programme for recovered beneficiaries one by one (in gram/kg/day):
//Individual weight gain = [W 2 - W1 / W] / T (in gram/kg/day)
//W = Weight in kg on the day of entry to the programme (for Kwashiorkor cases day of minimum weight)
//W1 = Weight in grams on day of entry to the programme (for Kwashiorkor cases day of minimum weight)
//W2 = Weight in grams the day of discharge from the programme
//T = Number of days elapsed between W1 and W2
*Subsequently, the average out of these individual weight gains will be calculated:
*Average weight gain = Sum of individual weight gains (gram/kg/day) / Total number of beneficiaries
generate g_kg_day=.
replace g_kg_day=(total_weight_gain/adm_weight)/los
*lfu weight in g minus adm weight in g, divided by adm weight in kg, divided by los in days
*check for implausible avg weight gains (g/kg/day), defined as a change in either direction of more than 25 g/kg/day:
///n=0
replace implausible_value=1 if g_kg_day>25 & g_kg_day !=.
replace implausible_value=1 if g_kg_day<-25 & g_kg_day !=.
tabstat g_kg_day, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest g_kg_day, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress g_kg_day i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress g_kg_day i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
save "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\clean_dataset_for_analysis_28 May 2019_avgwtgain.dta", replace
*MUAC gain (total and mm/day) (select only those with a recovered outcome)
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
drop if adm_date==.
replace recovered=0 if died==1
replace recovered=0 if nonresponse==1
drop if recovered==0
drop if adm_muac==.
***Total MUAC gain (mm)
generate total_cm_gain=.
replace total_cm_gain= lfu_muac- adm_muac
generate total_mm_gain=.
replace total_mm_gain=total_cm_gain*10
browse if total_cm_gain<0
tabstat total_mm_gain, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest total_mm_gain, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress total_mm_gain i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress total_mm_gain i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
***MUAC gain/day (mm/day)
generate mm_day=.
replace mm_day=total_mm_gain/los
*check for implausible muac gains (defined as a muac change in either direction of more than 15mm/week, or 2.14mm/day):
///n=0
replace implausible_value=1 if mm_day>2.14 & mm_day !=.
replace implausible_value=1 if mm_day<-2.14 & mm_day !=.
tabstat mm_day, stats (n mean semean) by(intervention)
*to adjust SE for clustering:
encode site, generate(site_enc)
clttest mm_day, by(intervention) cluster(site_enc)
*Mean Difference unadjusted:
regress mm_day i.intervention, vce(cluster site_enc) base
*Mean difference adjusted for age, sex and country:
regress mm_day i.intervention child_age_months_calc i.child_sex i.country, vce(cluster site_enc)
save "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\clean_dataset_for_analysis_30 Sep 2019_avgmuacgain.dta", replace
*Non-inferiority graph
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
twoway (scatter comparison difference, mcolor(black) msymbol(square)) ///
(rspike lower_CI upper_CI comparison, horizontal), ///
ytitle("") yscale(reverse) yscale(noline) ///
ylabel(1(1)4, labsize(normal) labels angle(horizontal) valuelabel noticks) ///
xtitle("Difference in recovery proportions (95% CI)") ///
xtitle(, margin(small)) b2title("<-- favors standard protocol favors combined protocol -->", size(small)) ///
xscale(range(-0.15 0.15)) xline(0) xline(-0.1, lpattern(dash)) text(0.6 -0.1 "Non-inferiority margin", size(small)) ///
xlabel(-0.15(0.05)0.15, labsize(medium)) legend(off) scheme(s1mono) ///
title("") subtitle(" ") aspectratio(0.5) plotregion(margin(medium) lcolor(none))
graph export "Non-inferiority.pdf", as(pdf) replace
*Survival Analyses/Kaplan-Meier plots:
*KM Per Protocol Plots
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
*First, set an 'outcome date' for any children who do not have an lfu_date, to ensure all stay in the KM analyses.
gen outcome_date=.
replace outcome_date=lfu_date if lfu_date!=.
replace outcome_date=adm_date + 1 if lfu_date==.
*Then, apply exclusions to make this a per-protocol analysis:
//Make all outcomes mutually exclusive (this is different from the other analyses- because a cut-off for nonresponse is not specified. Therefore total recovered WILL NOT MATCH RECOVERED IN MAIN ANALYSIS; IT WILL BE HIGHER):
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
**New way: create a flag of observations that will be removed from PP analysis:
generate pp = 1
replace pp = 0 if defaulter==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0 & early_cured_discharge==0 & early_nonresponse_discharge==0
replace pp = 0 if transferred_new==1 & died==0 & nonresponse==0 & recovered==0
replace pp = 0 if transferred_sc==1 & died==0 & nonresponse==0 & recovered==0
replace pp = 0 if early_cured_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
replace pp = 0 if early_nonresponse_discharge==1 & died==0 & nonresponse==0 & recovered==0 & transferred==0
tab pp intervention
replace recovered=0 if died==1
*KM graph of only recovered children
stset outcome_date if pp==1 & recovered==1, origin(adm_date) fail(recovered) scale(7) // stset on date of final outcome, with time starting from date of admission; scale(7) defines the time in weeks i.e. days (as set up above) divided by 7
sts graph, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered")title ("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM_PP_recovered.pdf"
stsum, by(intervention)
*KM graph of all children (not just recovered)
stset outcome_date if pp==1, origin(adm_date) fail(recovered) scale(7)
sts graph, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered")title ("Supplemental Figure 1: Time to recovery for all children in PP analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 1_Time to recovery for all children in PP analysis.pdf", replace
graph export "Supplemental figure 1_Time to recovery for all children in PP analysis.png", replace
stsum, by(intervention)
*for SAM vs MAM on admission:
*SAM (of recovered only):
stset outcome_date if pp==1 & recovered==1, origin(adm_date) fail(recovered) scale(7)
sts graph if SAM==1 & recovered==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM PP_SAM_recovered.pdf"
*SAM (of all children):
stset outcome_date if pp==1, origin(adm_date) fail(recovered) scale(7)
sts graph if SAM==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("Supplemental Figure 3: Time to recovery for SAM children in PP analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 3_Time to recovery for SAM children in PP analysis.pdf", replace
graph export "Supplemental figure 3_Time to recovery for SAM children in PP analysis.png", replace
*MAM (of recovered only):
stset outcome_date if pp==1 & recovered==1, origin(adm_date) fail(recovered) scale(7)
sts graph if MAM==1 & recovered==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM PP_MAM_recovered.pdf"
*MAM (of all children):
stset outcome_date if pp==1, origin(adm_date) fail(recovered) scale(7)
sts graph if MAM==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("Supplemental Figure 5: Time to recovery for MAM children in PP analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 5_Time to recovery for MAM children in PP analysis.pdf", replace
graph export "Supplemental figure 5_Time to recovery for MAM children in PP analysis.png", replace
*for age <24 months (of all children):
stset outcome_date if pp==1, origin(adm_date) fail(recovered) scale(7)
sts graph if child_age_months_calc <24, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM PP_<24_all.pdf"
*for age >=24 months (of all children):
stset outcome_date if pp==1, origin(adm_date) fail(recovered) scale(7)
sts graph if child_age_months_calc >=24, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM PP_>=24_all.pdf"
*INTENTION TO TREAT KM PLOTS:
*KM ITT Plots
clear
use "C:\Users\jeanetteb\Documents\Final analysis stata work\stata_raw_data\de-identified_dataset_for_analysis_30 Sep 2019.dta"
*First, set an 'outcome date' for any children who do not have an lfu_date, to ensure all stay in the KM analyses.
gen outcome_date=.
replace outcome_date=lfu_date if lfu_date!=.
replace outcome_date=adm_date + 1 if lfu_date==.| outcome_date==adm_date
*Then, apply exclusions to make this an ITT analysis:
//Make all outcomes mutually exclusive (this is different from the other analyses- because a cut-off for nonresponse is not specified. Therefore total recovered WILL NOT MATCH RECOVERED IN MAIN ANALYSIS; IT WILL BE HIGHER):
drop if adm_date==.
***do this if removing the kids without admissions forms and others without admission date data. (It is necessary to drop the kids without adm forms because nonresponse outcome cannot be determined).
*early discharges (cured and nonresponse) are removed below (this captures Lieth)
*warmalual==1 are captured as defaulters and so are not in the PP analysis (all but two of Lieth- which are nonresponse)
replace recovered=0 if died==1
*KM graph of only recovered children
stset outcome_date if recovered==1, origin(adm_date) fail(recovered) scale(7) // stset on date of final outcome, with time starting from date of admission; scale(7) defines the time in weeks i.e. days (as set up above) divided by 7
sts graph, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered")title ("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM ITT_recovered.pdf", replace
stsum, by(intervention)
*KM graph of all children (not just recovered)
stset outcome_date, origin(adm_date) fail(recovered) scale(7) // stset on date of final outcome, with time starting from date of admission; scale(7) defines the time in weeks i.e. days (as set up above) divided by 7
tab _st
*** (April 17)- below code used to identify the 1 child that was previously dropped from ITT because adm_date= outcome_date:
*br adm_date site caseid outcome_date adm_date recovered if _st == 0
*format outcome_date %d
sts graph, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered")title ("Supplemental Figure 2: Time to recovery for all children in ITT analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 2_Time to recovery for all children in ITT analysis.pdf", replace
graph export "Supplemental figure 2_Time to recovery for all children in ITT analysis.png", replace
stsum, by(intervention)
*for SAM vs MAM on admission:
*SAM (of recovered only):
stset outcome_date if SAM==1 & recovered==1, origin(adm_date) fail(recovered) scale(7)
sts graph if SAM==1 & recovered==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM ITT_SAM_recovered.pdf"
*SAM (of all children):
stset outcome_date if SAM==1, origin(adm_date) fail(recovered) scale(7)
sts graph if SAM==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("Supplemental Figure 4: Time to recovery for SAM children in ITT analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 4_Time to recovery for SAM children in ITT analysis.pdf", replace
graph export "Supplemental figure 4_Time to recovery for SAM children in ITT analysis.png", replace
*MAM (of recovered only):
stset outcome_date if MAM==1 & recovered==1, origin(adm_date) fail(recovered) scale(7)
sts graph if MAM==1 & recovered==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM ITT_MAM_recovered.pdf"
*MAM (of all children):
stset outcome_date if MAM==1, origin(adm_date) fail(recovered) scale(7)
sts graph if MAM==1, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("Supplemental Figure 6: Time to recovery for MAM children in ITT analysis") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "Supplemental figure 6_Time to recovery for MAM children in ITT analysis.pdf", replace
graph export "Supplemental figure 6_Time to recovery for MAM children in ITT analysis.png", replace
*for age <24 months (of all children):
stset outcome_date, origin(adm_date) fail(recovered) scale(7)
sts graph if child_age_months_calc <24, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM ITT_<24_all.pdf"
*for age >=24 months (of all children):
stset outcome_date, origin(adm_date) fail(recovered) scale(7)
sts graph if child_age_months_calc >=24, by(intervention) failure xlabel(0(4)40) xtitle("Follow-up time in weeks") ytitle("Cumulative proportion recovered") title("") risktable(, order(1 "Standard protocol" 2 "Combined protocol") size(vsmall) failevents) legend(label(1 "Standard protocol") label(2 "Combined protocol"))
graph export "KM ITT_>=24_all.pdf"