*========================================== * STEM-TB Lesotho Overall Processing Code * Edmund Shen *========================================== /* The following data processing is dependent on output files initially generated by co-author Letizia Trevisi, who pulled datasets from the centralized endTB electronic database through which participating STEM-TB facilities uploaded relevant study data. Please contact the corresponding author if any of these files are needed for review. Exporting of regression results to Excel files depends on the outreg2 package. Please install using the command "ssc install outreg2" prior to running this code block, if you do not have outreg 2 locally downloaded your STATA. */ *========================== * Initial Data Setup *========================== clear * set working directory * cd [relevant working directory] * Import all pertinent SAS files and convert to stata .DTA files * (keeping same names for consistency) import sas using "derived.sas7bdat" save "derived.dta", replace clear import sas using "stemtb_cohort_unique.sas7bdat" save "stemtb_cohort_unique.dta", replace clear import sas using "perm_stop_drug.sas7bdat" save "perm_stop_drug.dta", replace clear import sas using "conversion_final.sas7bdat" save "conversion_final.dta", replace clear import sas using "culture_base.sas7bdat" save "culture_base.dta", replace clear import sas using "bact_culture_results_set1.sas7bdat" save "bact_culture_results_set1.dta", replace clear import sas using "s_outcome_end_of_tx_template.sas7bdat" save "s_outcome_end_of_tx_template.dta", replace clear import sas using "tests_baseline.sas7bdat" save "tests_baseline.dta", replace clear import sas using "encounter.sas7bdat" save "encounter.dta", replace clear import excel "miner_status.xlsx", sheet("Sheet1") firstrow save "miner_status.dta", replace clear * Turning on the log log using STEM_TB_Lesotho, replace *=============================================== **# Baseline characteristics *=============================================== use "derived.dta" * Limit derived dataset to only Lesotho observations drop if site!="Lesotho" * Generate variables for baseline radiographic / smear risk factors * Strict inclusion criteria (need to have recorded baseline measurement) gen highgrade = 1 if smear_90_7_base == 4 | smear_90_7_base == 5 replace highgrade = 0 if smear_90_7_base == 0 | smear_90_7_base == 1 | /// smear_90_7_base == 2 | smear_90_7_base == 3 gen cavity_base_binary = 1 if cavity_base == 1 | cavity_base == 2 replace cavity_base_binary = 0 if cavity_base == 0 * Missing CXR variable gen missing_cxr = 1 if cavity_base==. & fibrosis_base==. & bilateral_base==. replace missing_cxr = 0 if missing_cxr == . * Binned HIV variable gen hiv_bin_label = "HIV(-)" if hiv_base==0 replace hiv_bin_label = "HIV(+) CD4<=200" if hiv_base==1 & cd4_le200_base==1 replace hiv_bin_label = "HIV(+) CD4>200" if hiv_base==1 &cd4_le200_base==0 encode hiv_bin_label, gen(hiv_bin) tabulate hiv_bin * Multi-tiered fibrosis variable merge 1:1 regnum using "tests_baseline.dta", keepusing (fibrosis_90_30_base) drop if site != "Lesotho" drop _merge * Binary smear positive/negative categorization gen smear_pos_any = 1 if smear_90_7_base == 1 | smear_90_7_base == 2 | /// smear_90_7_base == 3 | smear_90_7_base == 4 | /// smear_90_7_base == 5 replace smear_pos_any = 0 if smear_90_7_base == 0 * Generate severe lung damage categories gen cavity_highgrade = 1 if cavity_base_binary == 1 & highgrade == 1 replace cavity_highgrade = 0 if cavity_base_binary == 0 & highgrade == 1 replace cavity_highgrade = 0 if cavity_base_binary == 1 & highgrade == 0 replace cavity_highgrade = 0 if cavity_base_binary == 0 & highgrade == 0 gen fibrocav = 1 if fibrosis_90_30_base > 1 & cavity_base > 1 & fibrosis_90_30_base != . & cavity_base != . replace fibrocav = 0 if fibrocav == . & fibrosis_90_30_base != . & cavity_base != . * Summarize demographic / baseline variables summarize age_study_drug, detail tabulate sex tabulate civil_base tabulate employ_base tabulate alcohol_base tabulate smoker_base tabulate hiv_base tabulate diab_tested_base replace diabetes_comb_base = . if diabetes_comb_base==99 tabulate diabetes_comb_base tabulate hepc_comb_base tabulate bilateral_base tabulate cavity_base tabulate fibrosis_base tabulate fibrosis_90_30_base tabulate smear_90_7_base tabulate cx_res_90_7_base tabulate smear_180_0_base tabulate cx_res_180_0_base tabulate lowbmi_base tabulate inhospital_base tabulate cavity_highgrade tabulate extensive_disease_who tabulate fibrocav tabulate bilateral_highgrade tabulate baseline_score tabulate missing_cxr tabulate prevtx_group save "derived_processed_Lesotho.dta", replace clear *=============================================== * Time to conversion calculations **# TimeConv calcs *=============================================== use "bact_culture_results_set1.dta" drop if site!="Lesotho" * Merge in data about baseline culture merge m:1 regnum using "culture_base.dta", keepusing (d_coll_cx_90_7 cx_res_90_7_base) drop if _merge!= 3 drop _merge * Keep only patients with positive baseline culture drop if cx_res_90_7_base != 1 * Exclude all cultures taken before the baseline culture drop if d_coll <= d_coll_cx_90_7 * Create variable to identify the first of two consecutive negative cultures sort regnum d_coll gen next_result = result_culture[_n+1] if regnum[_n+1] == regnum generate consecutive_negatives = 1 if result_culture==0 & next_result == 0 drop if consecutive_negatives != 1 * Keep only the first timepoint at which a patient is noted to have first of two consecutive negatives bysort regnum (d_coll): keep if _n == 1 * Generate new variable for time to conversion, with start = date of pos. culture * and End = date of first of two consecutive negatives gen time_to_conversion_new = d_coll - d_coll_cx_90_7 summarize time_to_conversion_new, detail save "bact_culture_results_set1_processed_Lesotho.dta", replace clear *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Generate final culture conversion table *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ use "culture_base.dta" drop if site != "Lesotho" drop if cx_res_90_7_base != 1 merge 1:1 regnum using "bact_culture_results_set1_processed_Lesotho.dta", keepusing(id_emr time_to_conversion_new) gen cult_conv = 1 if time_to_conversion_new != . replace cult_conv = 0 if cult_conv == . save "conversion_final_new.dta", replace clear *=============================================== * EOT outcomes for Lesotho - data prep *=============================================== use "stemtb_cohort_unique.dta" drop if site != "Lesotho" save "stemtb_cohort_unique_processed_Lesotho.dta", replace clear *=============================================== * EOT outcomes for Lesotho **# EOT outcomes CCA *=============================================== use "derived_processed_Lesotho.dta" * Merge in the Lesotho outcomes merge 1:1 regnum using "s_outcome_end_of_tx_template.dta", keepusing(stemtbeotoutcome) drop _merge drop if site != "Lesotho" * Generate new outcome binary for "cured" vs not gen eot_cure = 1 if stemtbeotoutcome==1 | stemtbeotoutcome==2 * Include deaths as unfavorable replace eot_cure = 0 if stemtbeotoutcome == 3 * Include the failed cases replace eot_cure = 0 if stemtbeotoutcome == 4 * Exclude cases which were LTF, withdrawn, or not evaluated replace eot_cure = . if stemtbeotoutcome == 5 | stemtbeotoutcome == 6 | stemtbeotoutcome == 7 * Summarize demographic / baseline variables summarize age_study_drug if eot_cure != ., detail tabulate sex if eot_cure != . tabulate civil_base if eot_cure != . tabulate employ_base if eot_cure != . tabulate alcohol_base if eot_cure != . tabulate smoker_base if eot_cure != . tabulate hiv_base if eot_cure != . tabulate diab_tested_base if eot_cure != . tabulate diabetes_comb_base if eot_cure != . tabulate hepc_comb_base if eot_cure != . tabulate bilateral_base if eot_cure != . tabulate cavity_base if eot_cure != . tabulate fibrosis_base if eot_cure != . tabulate fibrosis_90_30_base if eot_cure != . tabulate smear_90_7_base if eot_cure != . tabulate cx_res_90_7_base if eot_cure != . tabulate smear_180_0_base if eot_cure != . tabulate cx_res_180_0_base if eot_cure != . tabulate lowbmi_base if eot_cure != . tabulate inhospital_base if eot_cure != . tabulate cavity_highgrade if eot_cure != . tabulate extensive_disease_who if eot_cure != . tabulate fibrocav if eot_cure != . tabulate bilateral_highgrade if eot_cure != . tabulate baseline_score if eot_cure != . tabulate missing_cxr if eot_cure != . tabulate prevtx_group if eot_cure != . tabulate severe_lung_1 if eot_cure != . tabulate severe_lung_2 if eot_cure != . * Summarize demographic / baseline variables, stratified by HIV status summarize age_study_drug if hiv_base == 0 & eot_cure != ., detail summarize age_study_drug if hiv_base == 1 & eot_cure != ., detail ttest age_study_drug, by(hiv_base) tabulate sex hiv_base if eot_cure != . , chi2 tabulate civil_base hiv_base if eot_cure != . , chi2 tabulate employ_base hiv_base if eot_cure != . , chi2 tabulate alcohol_base hiv_base if eot_cure != . , chi2 tabulate smoker_base hiv_base if eot_cure != . , chi2 tabulate hiv_base hiv_base if eot_cure != . , chi2 tabulate diab_tested_base hiv_base if eot_cure != . , chi2 tabulate diabetes_comb_base hiv_base if eot_cure != . , chi2 tabulate hepc_comb_base hiv_base if eot_cure != . , chi2 tabulate bilateral_base hiv_base if eot_cure != . , chi2 tabulate cavity_base hiv_base if eot_cure != . , chi2 tabulate fibrosis_base hiv_base if eot_cure != . , chi2 tabulate fibrosis_90_30_base hiv_base if eot_cure != . , chi2 tabulate smear_90_7_base hiv_base if eot_cure != . , chi2 tabulate cx_res_90_7_base hiv_base if eot_cure != . , chi2 tabulate smear_180_0_base hiv_base if eot_cure != . , chi2 tabulate cx_res_180_0_base hiv_base if eot_cure != . , chi2 tabulate lowbmi_base hiv_base if eot_cure != . , chi2 tabulate inhospital_base hiv_base if eot_cure != . , chi2 tabulate cavity_highgrade hiv_base if eot_cure != . , chi2 tabulate extensive_disease_who hiv_base if eot_cure != . , chi2 tabulate fibrocav hiv_base if eot_cure != . , chi2 tabulate bilateral_highgrade hiv_base if eot_cure != . , chi2 tabulate baseline_score hiv_base if eot_cure != . , chi2 tabulate missing_cxr hiv_base if eot_cure != . , chi2 tabulate prevtx_group hiv_base if eot_cure != . , chi2 tabulate severe_lung_1 hiv_base if eot_cure != . , chi2 tabulate severe_lung_2 hiv_base if eot_cure != . , chi2 * Sensitivity analysis including LTF cases gen eot_cure_mod = 1 if stemtbeotoutcome == 1 | stemtbeotoutcome == 2 replace eot_cure_mod = 0 if stemtbeotoutcome == 3 | stemtbeotoutcome == 4 | stemtbeotoutcome == 5 * Merge post-treatment outcomes dataset merge 1:1 regnum using "encounter.dta", keepusing() drop if site != "Lesotho" drop _merge * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Logistic regressions for EOT_cure * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * For baseline cavitary disease logit eot_cure cavity_base_binary outreg2 using "logit_EOTcure_results.xls", ci eform replace addstat(Pseudo R^2, e(r2_p)) logit eot_cure cavity_base_binary if hiv_base == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure cavity_base_binary if hiv_base == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For baseline fibrosis logit eot_cure fibrosis_base outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrosis_base if hiv_base == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrosis_base if hiv_base == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrosis_base outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For baseline bilateral disease logit eot_cure bilateral_base outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure bilateral_base if hiv_base == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure bilateral_base if hiv_base == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod bilateral_base outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For baseline smear grade 2+ or 3+ logit eot_cure highgrade outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure highgrade if hiv_base == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod highgrade outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For baseline missing CXR logit eot_cure missing_cxr outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod missing_cxr outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For baseline cavitary disease + high smear grade logit eot_cure cavity_highgrade outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_highgrade outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * Severe fibrocavitary disease logit eot_cure fibrocav outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrocav if highgrade == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrocav if highgrade == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrocav outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrocav if highgrade == 0 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrocav if highgrade == 1 outreg2 using "logit_EOTcure_results.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * For all four elements, disaggregated logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade outreg2 using "logit_EOTcure_disaggregate.xls", ci eform replace addstat(Pseudo R^2, e(r2_p)) logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade /// if hiv_base == 0 outreg2 using "logit_EOTcure_disaggregate.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade /// if hiv_base == 1 outreg2 using "logit_EOTcure_disaggregate.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary fibrosis_base bilateral_base highgrade outreg2 using "logit_EOTcure_disaggregate.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) save "EOToutcomes_regressions_processed_Lesotho.dta", replace *=================================== * Time to Conversion Cox regressions **# TTC Cox CCA *=================================== use "conversion_final_new.dta" drop _merge * Horizontal merge data from previous EOToutcome and linreg regressions merge 1:1 regnum using "EOToutcomes_regressions_processed_Lesotho.dta" drop _merge merge 1:1 regnum using "bact_culture_results_set1_processed_Lesotho.dta", keepusing(time_to_conversion_new) drop _merge * Drop participants who were withdrawn / not included in efficacy analyses merge 1:1 regnum using "stemtb_cohort_unique_processed_Lesotho.dta", keepusing(outcome d_max_followup d_starttx) drop _merge replace outcome = 4 if id_emr == "LSS-001-00185" drop if outcome == 5 | outcome == 6 | outcome == 7 drop if cult_conv == . * Right-censor participants who don't culture convert * Set the survival data for Cox regressions stset time_to_conversion_new, failure(cult_conv) * Univariate single predictor analyses stcox cavity_base_binary outreg2 using "coxreg_cultconv.xls", ci eform replace stcox fibrosis_base outreg2 using "coxreg_cultconv.xls", ci eform append stcox bilateral_base outreg2 using "coxreg_cultconv.xls", ci eform append stcox highgrade outreg2 using "coxreg_cultconv.xls", ci eform append * Univariate single predictor analyses, stratified by HIV status stcox cavity_base_binary if hiv_base == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox fibrosis_base if hiv_base == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox bilateral_base if hiv_base == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox highgrade if hiv_base == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox cavity_base_binary if hiv_base == 1 outreg2 using "coxreg_cultconv.xls", ci eform append stcox fibrosis_base if hiv_base == 1 outreg2 using "coxreg_cultconv.xls", ci eform append stcox bilateral_base if hiv_base == 1 outreg2 using "coxreg_cultconv.xls", ci eform append stcox highgrade if hiv_base == 1 outreg2 using "coxreg_cultconv.xls", ci eform append * Fractionated cavitary and high smear grade combinations stcox cavity_highgrade outreg2 using "coxreg_cultconv.xls", ci eform append stcox fibrocav outreg2 using "coxreg_cultconv.xls", ci eform append stcox fibrocav if highgrade == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox fibrocav if highgrade == 1 outreg2 using "coxreg_cultconv.xls", ci eform append * Multivariate regression of imaging factors and smear grade stcox cavity_base_binary fibrosis_base bilateral_base highgrade outreg2 using "coxreg_cultconv.xls", ci eform append stcox cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 0 outreg2 using "coxreg_cultconv.xls", ci eform append stcox cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 1 outreg2 using "coxreg_cultconv.xls", ci eform append save "time_to_conv_cox_regressions.dta",replace clear *=================================== * Post-Tx Outcomes analysis **# PostTx CCA *=================================== use "EOToutcomes_regressions_processed_Lesotho.dta" * Post-treatment outcome summary tab details_post_enc tab has_posttxout tab f_posttxoutcome * Generate final treatment outcomes gen final_fav = 1 if eot_cure == 1 replace final_fav = 0 if eot_cure == 0 replace final_fav = 0 if eot_cure == 1 & f_posttxoutcome == 2 | f_posttxoutcome == 3 * Sensitivity analysis for inclusion of the two EOT-lost to followup patients gen final_fav_ltf = final_fav replace final_fav_ltf = 0 if stemtbeotoutcome == 5 * Univariate single predictor analyses - ALL final outcomes logit final_fav cavity_base_binary outreg2 using "postTx_outcomes.xls", ci eform replace logit final_fav fibrosis_base outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav bilateral_base outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav highgrade outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf fibrosis_base outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf bilateral_base outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf highgrade outreg2 using "postTx_outcomes.xls", ci eform append * Univariate single predictor analyses, stratified by HIV status - ALL final outcomes logit final_fav cavity_base_binary if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav fibrosis_base if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav bilateral_base if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav highgrade if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf fibrosis_base if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf bilateral_base if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf highgrade if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav cavity_base_binary if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav fibrosis_base if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav bilateral_base if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav highgrade if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf fibrosis_base if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf bilateral_base if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf highgrade if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append * Fractionated cavitary and high smear grade combinations - ALL final outcomes logit final_fav cavity_highgrade outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav fibrocav outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_highgrade outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf fibrocav outreg2 using "postTx_outcomes.xls", ci eform append * Multivariate regression of imaging factors and smear grade - ALL final outcomes logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 0 outreg2 using "postTx_outcomes.xls", ci eform append logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade if hiv_base == 1 outreg2 using "postTx_outcomes.xls", ci eform append save "postTxOutcomes_regressions_processed_Lesotho.dta", replace clear *=================================== * Missing indicator method analyses * For Post-Treatment outcomes **# PostTx MIM *=================================== use "postTxOutcomes_regressions_processed_Lesotho.dta" * Generate missing indicator variables for the combination imaging/smear criteria gen missing_highgrade = 1 if highgrade == . replace missing_highgrade = 0 if missing_highgrade == . gen missing_cavity_highgrade = 1 if cavity_highgrade == . replace missing_cavity_highgrade = 0 if missing_cavity_highgrade == . gen missing_smear_only = 1 if smear_90_7_base == . & missing_cxr == 0 replace missing_smear_only = 0 if smear_90_7_base == . & missing_cxr == 1 replace missing_smear_only = 0 if smear_90_7_base != . * Coerce missing entries with zeros replace cavity_base_binary = 0 if cavity_base_binary == . replace fibrosis_base = 0 if fibrosis_base == . replace bilateral_base = 0 if bilateral_base == . replace highgrade = 0 if highgrade == . replace cavity_highgrade = 0 if cavity_highgrade == . replace fibrocav = 0 if fibrocav == . * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * MIM for inidividual imaging criteria * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Individual baseline factors - ALL final outcomes logit final_fav cavity_base_binary missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform replace addstat(Pseudo R^2, e(r2_p)) logit final_fav fibrosis_base missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav bilateral_base missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav highgrade missing_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf cavity_base_binary missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf fibrosis_base missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf bilateral_base missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf highgrade missing_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * Individual baseline factors stratified by HIV - ALL final outcomes logit final_fav cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav bilateral_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav highgrade missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit final_fav cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav bilateral_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav highgrade missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform logit final_fav_ltf cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf bilateral_base missing_cxr if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf highgrade missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav bilateral_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav highgrade missing_highgrade if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit final_fav cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav bilateral_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform firthlogit final_fav highgrade missing_highgrade if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform logit final_fav_ltf cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf bilateral_base missing_cxr if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf highgrade missing_highgrade if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) * Fractionated extensive disease outcomes - ALL final outcomes logit final_fav cavity_highgrade missing_cavity_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store postTx_diff_treat logit final_fav fibrocav missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store postTx_fibrocav logit final_fav cavity_highgrade fibrocav missing_cxr missing_smear_only outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store postTx_combined logit final_fav fibrocav missing_cxr if highgrade == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav fibrocav missing_cxr if highgrade == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf cavity_highgrade missing_cavity_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf fibrocav missing_cxr outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) estimates save ratios, replace * Multivariate regression of imaging factors and smear grade - ALL final outcomes logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append logit final_fav cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "postTx_outcomes_MIM.xls", ci eform append logit final_fav_ltf cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 1 outreg2 using "postTx_outcomes_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) save "postTxOutcomes_regressions_MIM_processed_Lesotho.dta", replace clear *=================================== * Missing indicator method analyses * For EOT outcomes **# EOT outcomes MIM *=================================== use "EOToutcomes_regressions_processed_Lesotho.dta" estimates use ratios * Generate missing variable indicators gen missing_highgrade = 1 if highgrade == . replace missing_highgrade = 0 if missing_highgrade == . gen missing_cavity_highgrade = 1 if cavity_highgrade == . replace missing_cavity_highgrade = 0 if missing_cavity_highgrade == . gen missing_smear_only = 1 if smear_90_7_base == . & missing_cxr == 0 replace missing_smear_only = 0 if smear_90_7_base == . & missing_cxr == 1 replace missing_smear_only = 0 if smear_90_7_base != . * Coerce missing values to zero, per MIM replace cavity_base_binary = 0 if cavity_base_binary == . replace fibrosis_base = 0 if fibrosis_base == . replace bilateral_base = 0 if bilateral_base == . replace highgrade = 0 if highgrade == . replace cavity_highgrade = 0 if cavity_highgrade == . replace fibrocav = 0 if fibrocav == . * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * MIM for inidividual imaging criteria * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *** For baseline cavitary disease logit eot_cure cavity_base_binary missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform replace addstat(Pseudo R^2, e(r2_p)) logit eot_cure cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append logit eot_cure cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod cavity_base_binary missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *** For baseline fibrosis logit eot_cure fibrosis_base missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append logit eot_cure fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod fibrosis_base missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *** For baseline bilateral disease logit eot_cure bilateral_base missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure bilateral_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure bilateral_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append logit eot_cure bilateral_base missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod bilateral_base missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod bilateral_base missing_cxr if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod bilateral_base missing_cxr if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *** For baseline high smear grade logit eot_cure highgrade missing_highgrade outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure highgrade missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure highgrade missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append logit eot_cure highgrade missing_highgrade if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod highgrade missing_highgrade outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod highgrade missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod highgrade missing_highgrade if hiv_base == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *** For combined phenotypes logit eot_cure cavity_highgrade missing_cavity_highgrade outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store EOT_diff_treat logit eot_cure fibrocav missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store EOT_fibrocav logit eot_cure cavity_highgrade fibrocav missing_cxr missing_smear_only outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) est store EOT_combined logit eot_cure fibrocav missing_cxr if highgrade == 0 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure fibrocav missing_cxr if highgrade == 1 outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod cavity_highgrade missing_cavity_highgrade outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod fibrocav missing_cxr outreg2 using "logit_EOTcure_results_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) estimates save ratios, replace *** With all four individual criteria logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform replace addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) firthlogit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append logit eot_cure cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 1 outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) *-----------------* logit eot_cure_mod cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) logit eot_cure_mod cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 1 outreg2 using "logit_EOTcure_disaggregate_MIM.xls", ci eform append addstat(Pseudo R^2, e(r2_p)) save "EOToutcomes_regressions_MIM_processed_Lesotho.dta", replace clear *=============================================== **# TTC Cox MIM *=============================================== use "time_to_conv_cox_regressions.dta" estimates use ratios * Generate missing variable indicators gen missing_highgrade = 1 if highgrade == . replace missing_highgrade = 0 if missing_highgrade == . gen missing_cavity_highgrade = 1 if cavity_highgrade == . replace missing_cavity_highgrade = 0 if missing_cavity_highgrade == . gen missing_smear_only = 1 if smear_90_7_base == . & missing_cxr == 0 replace missing_smear_only = 0 if smear_90_7_base == . & missing_cxr == 1 replace missing_smear_only = 0 if smear_90_7_base != . * Coerce missing values to zero replace cavity_base_binary = 0 if cavity_base_binary == . replace fibrosis_base = 0 if fibrosis_base == . replace bilateral_base = 0 if bilateral_base == . replace highgrade = 0 if highgrade == . replace cavity_highgrade = 0 if cavity_highgrade == . replace fibrocav = 0 if fibrocav == . * Set the survival data for Cox regressions stset time_to_conversion_new, failure(cult_conv) * Univariate single predictor analyses stcox cavity_base_binary missing_cxr outreg2 using "coxreg_cultconv_MIM.xls", ci eform replace stcox fibrosis_base missing_cxr outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox bilateral_base missing_cxr outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox highgrade missing_highgrade outreg2 using "coxreg_cultconv_MIM.xls", ci eform append * Univariate single predictor analyses, stratified by HIV status stcox cavity_base_binary missing_cxr if hiv_base == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox fibrosis_base missing_cxr if hiv_base == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox bilateral_base missing_cxr if hiv_base == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox highgrade missing_highgrade if hiv_base == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox cavity_base_binary missing_cxr if hiv_base == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox fibrosis_base missing_cxr if hiv_base == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox bilateral_base missing_cxr if hiv_base == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox highgrade missing_highgrade if hiv_base == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append * Fractionated cavitary and high smear grade combinations stcox cavity_highgrade missing_cavity_highgrade outreg2 using "coxreg_cultconv_MIM.xls", ci eform append est store cox_diff_treat stcox fibrocav missing_cxr outreg2 using "coxreg_cultconv_MIM.xls", ci eform append est store cox_fibrocav stcox cavity_highgrade fibrocav missing_cxr missing_smear_only outreg2 using "coxreg_cultconv_MIM.xls", ci eform append est store cox_combined stcox fibrocav missing_cxr if highgrade == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox fibrocav missing_cxr if highgrade == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append estimates save ratios, replace coefplot (cox_diff_treat EOT_diff_treat postTx_diff_treat, label("Cavitary Disease & High Smear Grade, Unadjusted")) (cox_fibrocav EOT_fibrocav postTx_fibrocav, label("Severe Fibrocavitary Disease, Unadjusted")) (cox_combined EOT_combined postTx_combined, keep(cavity_highgrade) label("Cavitary Disease & High Smear Grade, Adjusted"))(cox_combined EOT_combined postTx_combined, keep(fibrocav) label("Severe Fibrocavitary Disease, Adjusted")),eform xline(1) drop(missing_cxr missing_cavity_highgrade missing_smear_only _cons) msize(medium) mcolor(black) ciopts(lcolor(black)) scheme(s1mono) xtitle("Hazard Ratio* or Odds Ratio**") xlabel(0(0.2)2) graph save forest_combined.gph, replace * Multivariate regression of imaging factors and smear grade stcox cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 0 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append stcox cavity_base_binary fibrosis_base bilateral_base highgrade missing_cxr missing_highgrade if hiv_base == 1 outreg2 using "coxreg_cultconv_MIM.xls", ci eform append save "time_to_conv_cox_regressions_MIM.dta",replace clear *=============================================== **# KM Culture Conversion Curves *=============================================== use "conversion_final_new.dta" drop _merge rename time_to_conversion_new time_to_conv_new * Horizontal merge data from derived.dta (extensive_disease variable) merge 1:1 regnum using "derived_processed_Lesotho.dta" drop _merge * Drop participants who were withdrawn / not included in efficacy analyses merge 1:1 regnum using "stemtb_cohort_unique_processed_Lesotho.dta", keepusing(outcome d_max_followup d_starttx) drop _merge drop if outcome == 5 | outcome == 6 | outcome == 7 drop if cult_conv == . * Right-censor participants who don't culture convert * Summary stats regarding culture conversion time (only including those who converted) summarize time_to_conv_new if cult_conv == 1, detail summarize time_to_conv_new if cult_conv == 1 & hiv_base == 0, detail summarize time_to_conv_new if cult_conv == 1 & hiv_base == 1, detail summarize time_to_conv_new if cult_conv == 1 & cavity_highgrade == 1, detail summarize time_to_conv_new if cult_conv == 1 & cavity_highgrade == 0, detail summarize time_to_conv_new if cult_conv == 1 & fibrocav == 1, detail summarize time_to_conv_new if cult_conv == 1 & fibrocav == 0, detail * Summary stats regarding culture conversion time (for ALL individuals) summarize time_to_conv_new, detail summarize time_to_conv_new if hiv_base == 0, detail summarize time_to_conv_new if hiv_base == 1, detail summarize time_to_conv_new if cavity_highgrade == 1, detail summarize time_to_conv_new if cavity_highgrade == 0, detail summarize time_to_conv_new if fibrocav == 1, detail summarize time_to_conv_new if fibrocav == 0, detail * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * For overall KM culture conversion curve * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Set the survival data for KM curve - WHO criteria stset time_to_conv_new, failure(cult_conv) * Kaplan-Meier curve and statistical tests - WHO criteria sts graph, survival graph save cult_conv_overall.gph, replace sts graph if hiv_base == 0, survival graph save cult_conv_overall_noHIV.gph, replace sts graph if hiv_base == 1, survival graph save cult_conv_overall_HIV.gph, replace * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Other KM culture conversion curves * Split by imaging and smear criteria * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * For baseline cavitary disease sts graph, survival by(cavity_base_binary) graph save cult_conv_cavity_base_binary.gph, replace sts test cavity_base_binary sts test cavity_base_binary, cox sts test cavity_base_binary, peto sts test cavity_base_binary, tware * For baseline fibrosis sts graph, survival by(fibrosis_base) graph save cult_conv_fibrosis_base.gph, replace sts test fibrosis_base sts test fibrosis_base, cox sts test fibrosis_base, peto sts test fibrosis_base, tware * For baseline bilateral disease sts graph, survival by(bilateral_base) graph save cult_conv_bilateral_base.gph, replace sts test bilateral_base sts test bilateral_base, cox sts test bilateral_base, peto sts test bilateral_base, tware * For baseline high smear grade sts graph, survival by(highgrade) graph save cult_conv_highgrade.gph, replace sts test highgrade sts test highgrade, cox sts test highgrade, peto sts test highgrade, tware * For baseline CXR missing sts graph, survival by(missing_cxr) graph save cult_conv_missing_cxr.gph, replace sts test missing_cxr sts test missing_cxr, cox sts test missing_cxr, peto sts test missing_cxr, tware * For HIV sts graph, survival by(hiv_base) graph save cult_conv_hiv_binary.gph, replace sts test hiv_base sts test hiv_base, cox sts test hiv_base, peto sts test hiv_base, tware * For baseline cavitary disease + high smear grade sts graph, survival by(cavity_highgrade) /// risktable /// xlabel(0(30)160) /// xtitle("Time to Culture Conversion (Days)") /// ylabel(0(0.25)1) /// ytitle("Proportion of Participants with Positive Culture") graph save cult_conv_cavity_highgrade.gph, replace sts test cavity_highgrade sts test cavity_highgrade, cox sts test cavity_highgrade, peto sts test cavity_highgrade, tware * For fibrocavitary disease sts graph, by(fibrocav) /// risktable /// xlabel(0(30)160) /// xtitle("Time to Culture Conversion (Days)") /// ylabel(0(0.25)1) /// ytitle("Proportion of Participants with Positive Culture") graph save cult_conv_fibrocav.gph, replace sts test fibrocav sts test fibrocav, cox sts test fibrocav, peto sts test fibrocav, tware save "conversion_final_processed_Lesotho.dta", replace clear *========================== * End-of-Run Data Cleanup *========================== *** Close Log at end of session *** log close translate STEM_TB_Lesotho.smcl STEM_TB_Lesotho.log, replace translate STEM_TB_Lesotho.smcl STEM_TB_Lesotho.pdf, replace clear