clear all use "C:\Users\Evan Laptop\OneDrive - UHN\Documents\PD\2018\Mucsi\Data management\Data Dump\2018-08-09\MergedSet-10-Aug-2018_13.dta" , replace cd "C:\Users\Evan Laptop\OneDrive - UHN\Documents\PD\2018\Mucsi\Data management\Data Dump\2018-05-10\do_files" do VariableNamesForAbstracts_Sept20_2017 // Prep // Individual Patient issues replace current_rrtmodality = 3 if mrn == 20163055 & current_rrtmodality == 4 // Classification var for phq (>=10) gen phqscore_2cat = 1 if phqscore >= 10 & !mi(phqscore) replace phqscore_2cat = 0 if phqscore < 10 & !mi(phqscore) label variable phqscore_2cat "PHQ Score - Moderate Depression (>=10)" label define phqscore_2cat 0 "No Moderate Depression" 1 "Moderate Depression" label values phqscore_2cat phqscore_2cat // Classification var for GAD (>= 10) gen gadscore_2cat = 1 if gadscore>= 10 & !mi(gadscore) replace gadscore_2cat = 0 if gadscore< 10 & !mi(gadscore) label variable gadscore_2cat "GAD Score - Moderate Anxiety (>=10)" label define gadscore_2cat 0 "No Moderate Anxiety" 1 "Moderate Anxiety" label values gadscore_2cat gadscore_2cat // Education gen edu_3cat = 1 if education == 2 | education == 3 replace edu_3cat = 2 if education == 4 | education == 5 | education == 6 replace edu_3cat = 3 if education >6 &!mi(education) label define edu_3cat 1 "Less than High School" 2 "High School Diploma or some college" 3 "College/uni" label values edu_3cat edu_3cat // DM group gen dmstatus = 1 if pmhx_diabetes == 1|one_point2_10 == 1|two_points2_13 == 1 replace dmstatus = 0 if mi(dmstatus) label variable dmstatus "DM yes or no" label define yesno 0 "No" 1 "Yes" label values dmstatus yesno // Ethnicity - merge aboriginal and unknown into a group replace ethnicity2 = 4 if mi(ethnicity2) label define ethnicity2 4 "Other/Unknown", modify // CCI Tertile replace cci_score = charlson_comorbidity_index if mi(cci_score) | (!mi(charlson_comorbidity_index) & !mi(cci_score)) xtile cci_tertile = cci_score, n(3) label variable cci_tertile "CCI score in tertiles" label define cci_tertile 1 "2 or less" 2 "3-4" 3"5+" label values cci_tertile cci_tertile // eGFR Tertiles gen ckdepi_gfr =. replace ckdepi_gfr=144*(((cr/61.9))^(-0.329))*(0.993^age) if sex==2 & cr<=61.9 replace ckdepi_gfr=144*(((cr/61.9))^(-1.209))*(0.993^age) if sex==2 & cr>61.9 replace ckdepi_gfr=141*(((cr/79.6))^(-0.411))*(0.993^age) if sex==1 & cr<=79.6 replace ckdepi_gfr=141*(((cr/79.6))^(-1.209))*(0.993^age) if sex==1 & cr>79.6 label variable ckdepi_gfr "CKD epi eGFR" // Population Block Identifier gen cohort = . replace cohort = 2 if current_rrtmodality == 1 | current_rrtmodality == 2 | current_rrtmodality == 5 replace cohort = 3 if current_rrtmodality == 3 replace cohort = 1 if current_rrtmodality == 4 label define cohort 2 "dialysis" 3 "post-transplant" 1 "pre-dialysis" label values cohort cohort // Depression Classification (PHQ) gen phq_depression = . replace phq_depression = 1 if phqscore < 5 replace phq_depression = 2 if phqscore >= 5 & phqscore <10 replace phq_depression = 3 if phqscore >= 10 & phqscore <15 replace phq_depression = 4 if phqscore >= 15 & !mi(phqscore) label define phq_depression 1 "No Depression" 2 "Mild Depression" 3"Moderate Depression" 4"Severe Depression" label values phq_depression phq_depression // Anxiety Classification (GAD) gen gad_anxiety = . replace gad_anxiety = 1 if gadscore < 5 replace gad_anxiety = 2 if gadscore >= 5 & gadscore <10 replace gad_anxiety = 3 if gadscore >= 10 & gadscore <15 replace gad_anxiety = 4 if gadscore >= 15 & !mi(gadscore) label define gad_anxiety 1 "No Anxiety" 2 "Mild Anxiety " 3"Moderate Anxiety " 4"Severe Anxiety " label values gad_anxiety gad_anxiety /* Population Blocking 1 - Dialysis and Post-Tx and RMC (no dialysis, no tx) 2 - Dialysis Alone 3 - Post Tx Alone */ // BLOCK 1 - Enrolled cohort of patients from dialysis, post-tx, RMC // Currently included studies: PROMIS, PROMIS Cat, Cat a, Cat B, Barriers, Pilot B/C drop if real_enrollment_status == 1 // Consented/Enrolled drop if mi(gadscore) & mi(phqscore) & mi(esasr7) & mi(esasr8) // missing all 4 // BLOCK 2 - Enrolled cohort of patients from dialysis // Currently included studies: PROMIS, PROMIS Cat, Barriers, Pilot B keep if cohort == 2 drop if real_enrollment_status == 1 drop if mi(gadscore) & mi(phqscore) & mi(esasr7) & mi(esasr8) // BLOCK 3 - Enrolled cohort of patients from renal tx // Currently included studies: Pilot C, PROMIS, Promis Cat, Cat a/b drop if real_enrollment_status == 1 keep if cohort == 3 drop if mi(gadscore) & mi(phqscore) & mi(esasr7) & mi(esasr8) // Baseline Descriptive // Table 1 foreach x of varlist sex ethnicity2 edu_3cat marital_status2 income2 cci_tertile dmstatus { tab `x', missing } sum age ckdepi_gfr alb hgb // Table 2 bysort cohort: sum age ckdepi_gfr alb hgb phqscore esasr7 gadscore esasr8 foreach x of varlist sex ethnicity2 edu_3cat marital_status2 income2 cci_tertile dmstatus gad_anxiety phq_depression{ bysort cohort: tab `x', missing } tab gad_anxiety, missing tab phq_depression, missing bysort cohort: tab gad_anxiety, missing bysort cohort: tab phq_depression , missing // Spearman // Anxiety spearman esasr8 gadscore, stats (rho p) bootstrap r(rho), reps (1000) nodots: spearman esasr8 gadscore estat bootstrap, all scatter esasr8 gadscore, jitter(15) // Depression spearman esasr7 phqscore, stats (rho p) bootstrap r(rho), reps (1000) nodots: spearman esasr7 phqscore estat bootstrap, all scatter esasr7 phqscore, jitter(15) // Histogram by cohort cd "C:\Users\Evan Laptop\OneDrive\Documents\Professional Development\2018\Mucsi\ESAS\ESAS Utility\Results" // Anxiety // GAD hist gadscore, discrete saving(gadscore_hist_all, replace) xtitle (" ") title("All Cohorts") nodraw hist gadscore if cohort == 1, discrete saving(gadscore_hist_prehd, replace) xtitle (" ") title("Pre-Dialysis") nodraw hist gadscore if cohort == 2, discrete saving(gadscore_hist_hd, replace) xtitle (" ") title("Dialysis") nodraw hist gadscore if cohort == 3, discrete saving(gadscore_hist_ktx, replace) xtitle ("GAD-7 Score") title("Post-Transplant") nodraw graph combine gadscore_hist_all.gph gadscore_hist_prehd.gph gadscore_hist_hd.gph gadscore_hist_ktx.gph, col(1) iscale(*.5) xcommon ycommon // ESAS8 hist esasr8, discrete saving(esasr8_hist_all, replace) xtitle (" ") title("All Cohorts") nodraw hist esasr8 if cohort == 1, discrete saving(esasr8_hist_prehd, replace) xtitle (" ") title("Pre-Dialysis") nodraw hist esasr8 if cohort == 2, discrete saving(esasr8_hist_hd, replace) xtitle (" ") title("Dialysis") nodraw hist esasr8 if cohort == 3, discrete saving(esasr8_hist_ktx, replace) xtitle ("ESASr Anxiety Score", size (large)) title("Post-Transplant") nodraw graph combine esasr8_hist_all.gph esasr8_hist_prehd.gph esasr8_hist_hd.gph esasr8_hist_ktx.gph, col(1) iscale(*.5) xcommon ycommon // Depression // PHQ hist phqscore, discrete saving(phqscore_hist_all, replace) xtitle (" ") title("All Cohorts") nodraw hist phqscore if cohort == 1, discrete saving(phqscore_hist_prehd, replace) xtitle (" ") title("Pre-Dialysis") nodraw hist phqscore if cohort == 2, discrete saving(phqscore_hist_hd, replace) xtitle (" ") title("Dialysis") nodraw hist phqscore if cohort == 3, discrete saving(phqscore_hist_ktx, replace) xtitle ("PHQ-9 Score", size (large)) title("Post-Transplant") nodraw graph combine phqscore_hist_all.gph phqscore_hist_prehd.gph phqscore_hist_hd.gph phqscore_hist_ktx.gph, col(1) iscale(*.5) xcommon ycommon // ESAS7 hist esasr7, discrete saving(esasr7_hist_all, replace) xtitle (" ") title("All Cohorts") nodraw hist esasr7 if cohort == 1, discrete saving(esasr7_hist_prehd, replace) xtitle (" ") title("Pre-Dialysis") nodraw hist esasr7 if cohort == 2, discrete saving(esasr7_hist_hd, replace) xtitle (" ") title("Dialysis") nodraw hist esasr7 if cohort == 3, discrete saving(esasr7_hist_ktx, replace) xtitle ("ESASr Depression Score", size (large)) title("Post-Transplant") nodraw graph combine esasr7_hist_all.gph esasr7_hist_prehd.gph esasr7_hist_hd.gph esasr7_hist_ktx.gph, col(1) iscale(*.5) xcommon ycommon // Anova between cohorts // Anxiety oneway gadscore cohort, sidak bonferroni scheffe oneway esasr8 cohort kwallis esasr8, by (cohort) dunntest esasr8, by(cohort) // Depression oneway phqscore cohort, sidak bonferroni scheffe oneway esasr7 cohort kwallis esasr7, by(cohort) dunntest esasr7, by(cohort) // Two-sample T-Test (dropping cohort of pre-dialysis) // NOTE: this destroys the integrity of the data. Reset the file after this block. // Prep - dropping predialysis drop if cohort == 1 // Anxiety median gadscore, by (cohort) median esasr8, by (cohort) // Depression median phqscore, by (cohort) median esasr7, by (cohort) // Sensitivity and Specificity // ROC // Nonparametric ROC for PHQ roctab phqscore_2cat esasr7 , detail nolabel graph summary table tab esasr7 dep_symp // Nonparametric ROC for GAD roctab gadscore_2cat esasr8, detail nolabel graph summary table tab esasr8 anx_symp // Cohorted Analysis of ROC - Dialysis // Nonparametric ROC for PHQ roctab phqscore_2cat esasr7 if cohort == 2, detail nolabel graph summary table tab esasr7 dep_symp if cohort == 2 // Nonparametric ROC for GAD roctab gadscore_2cat esasr8 if cohort == 2, detail nolabel graph summary table tab esasr8 anx_symp if cohort == 2 // Cohorted Analysis of ROC - Post-Tx // Nonparametric ROC for PHQ roctab phqscore_2cat esasr7 if cohort == 3, detail nolabel graph summary table tab esasr7 dep_symp if cohort == 3 // Nonparametric ROC for GAD roctab gadscore_2cat esasr8 if cohort == 3, detail nolabel graph summary table tab esasr8 anx_symp if cohort == 3 // Bayesian Plots - see excel // // ICC: This step destroys the integrity of the data. DO NOT run anything after this block expand 2 bysort mrn: gen tag = _n foreach x of varlist esasr7 esasr8 { replace `x' = `x'_6m if tag == 2 drop if `x'_6m == . icc `x' mrn tag } // Bland-Altman Plot - Limits of Agreement gen ba_anx_avg = (esasr8 + gadscore)/2 gen ba_anx_diff = (gadscore - esasr8)