/* Date Modified: Nov 22, 2020 */ clear all // log using "C:\Users\Evan Laptop\OneDrive - University of Toronto\Documents\PD\2018\Mucsi\Liver Transplant\Log\LT_Validation.smcl", replace set more off // use "C:\Users\Evan Laptop\OneDrive - University of Toronto\Documents\PD\2018\Mucsi\Data management\Data Dump\MergedSet_Jul-2020_13.dta" // qui do "C:\Users\Evan Laptop\OneDrive - University of Toronto\Documents\PD\2018\Mucsi\Data management\Data Dump\VariableNamesForAbstracts-Jul-2020.do" // qui do "C:\Users\Evan Laptop\OneDrive - University of Toronto\Documents\PD\2018\Mucsi\Liver Transplant\livdx_cause.do" // Fixing cause of chronic liver disease use "U:\data\dump\2020-12\Data_Sets14\MergedSet-Dec-2020.dta" qui do "U:\data\dump\2020-12\Data_Sets14\VariableNamesForAbstracts-Dec-2020.do" // qui do "U:\Student Folders\Evan\LiverTx Validation\livdx_cause.do" adopath ++ "U:\Student Folders\Evan\Ado" // adds this folder as a place that stata has to look for packages // For reference /* doe = date of baseline completion date_of_v2_completion = date of followup completion */ // Keep Liver Transplant only (18 = CatA Liver, 19 = CatB Liver) keep if study_name == 18 | study_name == 19 // Drop empty variables foreach var of varlist _all { capture assert mi(`var') if !_rc { drop `var' } } // Keep Enrolled (3) patients keep if real_enrollment_status == 3 // Drop if missing physical function T-score drop if mi(phys_tscore) // Variables // Modification of CCI categories (cci_2cat) gen cci_2cat = 1 if charlson_comorbidity_index < 5 replace cci_2cat = 2 if charlson_comorbidity_index >= 5 & !mi(charlson_comorbidity_index) label variable cci_2cat "Categorized CCI score >=4 and <4" label define cci_2cat 1 "<5" 2 ">=5", replace label values cci_2cat cci_2cat // Most recent transplant date (liver_transplant_date) gen liver_transplant_date = . // Generate variable replace liver_transplant_date = tx_dt // CRF transplant date replace liver_transplant_date = lvier_transplant_2 if mi(tx_dt) // Overwrite 1st transplant date if 2nd transplant date available replace liver_transplant_date = liver_transplant_1 if mi(liver_transplant_date) // First transplant date if missing dates format liver_transplant_date %d // Format to date variable label variable liver_transplant_date "Most Recent Liver Transplant Date" // Label Variable // Time since transplant (livertx_vintage) gen livertx_vintage = (doe - liver_transplant_date)/365.25 label variable livertx_vintage "Liver Transplant Vintage" // Binary Classification of EQ5D Mobility (mobility) capture drop mobility gen mobility = 1 if eq5d_1 == 1 replace mobility = 0 if eq5d_1 >1 & !mi(eq5d_1) label variable mobility "EQ5D Mobility Issues Categorized" label define mobility 1 "No Problems walking" 0 "Problems Walking", replace label values mobility mobility // SF36 Physical Function (ldqol_sf36_pf) foreach var of varlist ldqol_sf3* { gen `var'_sf36 = (`var'-1)/2*100 } // Scoring egen ldqol_sf36_pfmiss = rownonmiss(ldqol_sf3a_sf36-ldqol_sf3j_sf36) egen ldqol_sf36_pf = rowmean(ldqol_sf3a_sf36-ldqol_sf3j_sf36) if ldqol_sf36_pfmiss >0 label variable ldqol_sf36_pf "SF-36 Physical Function" // Dropping excess variables drop ldqol_sf3a_sf36-ldqol_sf3j_sf36 drop ldqol_sf36_pfmiss order ldqol_sf36_pf, after(ldqol_mh) // Age category capture drop age_youngold gen age_youngold = 1 if age <60 replace age_youngold = 2 if age >=60 & !mi(age) label variable age_youngold "Categorized age 65+" label define age_youngold 1 "<65" 2 ">=65", replace label values age_youngold age_youngold /* Note, this has been replaced with the block above // Also some completely blank patients that are skewing the count a bit, will censor them for now. egen tag = rownonmiss(_all), strok // counting all non-missing variables drop if mi(phys_tscore) & tag <200 // less than 200 variables is highly indicative of an empty entry drop tag */ /* // Evaluating Anxiety // Distribution of initial anxiety score (anx_tscore) hist anx_tscore // Distribution of followup anxiety score (anx_tscore_retest) hist anx_tscore_retest // Difference between initial and followup score qui gen temp = abs(anx_tscore - anx_tscore_retest) sum temp, detail qui drop temp // Number of initial questions sum anx_cnt, detail // Number of followup questions sum anx_retestcnt, detail */ // Evaluating Physical Function cd "U:\Student Folders\Evan\LiverTx Validation\graphs" // Change directory for // Summary of physical function (PROMIS, SF12, SF36) sum phys_tscore ldqol_pf ldqol_sf36_pf eq5d_1, detail // Distribution of initial physical function (phys_tscore) hist phys_tscore graph save "Distribution of Baseline physical function", replace graph export "Distribution of Baseline physical function.tif", width(2550) replace // Distribution of followup physical function score (phys_tscore_retest) hist phys_tscore_retest graph save "Distribution of Followup physical function", replace graph export "Distribution of Followup physical function.tif", width(2550) replace // Distribution of Physical Function (SF-12 PCS) hist ldqol_pf graph save "Distribution of SF-12 PCS", replace graph export "Distribution of SF-12 PCS.tif", width(2550) replace // Distribution of Physical Function (SF-36 PF) hist ldqol_sf36_pf graph save "Distribution of SF-36 PF", replace graph export "Distribution of SF-36 PF.tif", width(2550) replace // Distribution of Physical function (EQ5D Mobility) hist eq5d_1 graph save "Distribution of EQ5D Mobility", replace graph export "Distribution of EQ5D Mobility.tif", width(2550) replace // Convergent Validity Scatterplots qui spearman ldqol_pf phys_tscore local rho: display %05.3f =r(rho) graph twoway (lfitci ldqol_pf phys_tscore)(scatter ldqol_pf phys_tscore), ytitle("SF12-PCS") text(20 70 "Rho = `rho'") graph save "Scatterplot SF12 PCS and PF CAT", replace graph export "Scatterplot SF12 PCS and PF CAT.tif", replace qui spearman ldqol_sf36_pf phys_tscore local rho: display %05.3f =r(rho) graph twoway (lfitci ldqol_sf36_pf phys_tscore)(scatter ldqol_sf36_pf phys_tscore), ytitle("SF36-PF") text(20 70 "Rho = `rho'") graph save "Scatterplot SF36 PF and PF CAT", replace graph export "Scatterplot SF36 PF and PF CAT.tif", replace qui spearman eq5d_1 phys_tscore local rho: display %05.3f =r(rho) label variable eq5d_1 "EQ5D Mobility" graph twoway (lfitci eq5d_1 phys_tscore)(scatter eq5d_1 phys_tscore, jitter(5)), ytitle("EQ5D Mobility") text(3.5 70 "Rho = `rho'") graph save "Scatterplot EQ5D mobility and PF CAT", replace graph export "Scatterplot SF12 PCS and PF CAT.tif", replace graph combine "Scatterplot SF12 PCS and PF CAT.gph" "Scatterplot SF36 PF and PF CAT.gph" , cols(2) xsize(10) graph export "Scatterplot_SF12_CAT.tif", replace // Reliability Curve twoway scatter std_err_fin_phys_funct phys_theta || qfit std_err_fin_phys_funct phys_theta, /// xtitle("PROMIS PF CAT theta") ytitle("Standard Error of Measurement") legend(off) graph save "Reliability Curve", replace graph export "Reliability Curve.tif", width(2550) replace // Boxplot graph box phys_tscore, over(mobility, relabel(1 "Mobility Problems" 2 "No Mobility Problems")) ytitle("PROMIS PF CAT T-Score") graph export "TScore_Boxplot.tif", width(2550) replace // Difference between initial and followup score qui gen phys_tscore_diff = abs(phys_tscore - phys_tscore_retest) sum phys_tscore_diff, detail label variable phys_tscore_diff "Difference in score between BL and retest" // Label Variable // Time between baseline and retest gen retest_duration = date_of_v2_completion - doe label variable retest_duration "Days between baseline and retest" // Number of initial questions sum phys_cnt, detail hist phys_cnt // Number of followup questions sum phys_retestcnt, detail hist phys_retestcnt // Descriptive Stats foreach x of varlist sex ethnicity2 education marital_status2 income2 cci_2cat diabetes livdx_cause{ tab `x', missing } foreach x of varlist age alb hgb { qui sum `x' di "`x' mean: " r(mean) " sd " r(sd) } qui sum livertx_vintage, detail di "liver transplant vintage (median, iqr):" r(p50) ", " r(p25) "-" r(p75) // Descriptive stats by eq5d mobility binary var (mobility) foreach x of varlist sex ethnicity2 education marital_status2 income2 cci_2cat diabetes livdx_cause{ tab `x' mobility, missing } foreach x of varlist age alb hgb { qui sum `x' if mobility == 0 di "`x' problems mean: " r(mean) " sd " r(sd) qui sum `x' if mobility == 1 di "`x' No problems mean: " r(mean) " sd " r(sd) } qui sum livertx_vintage if mobility == 0, detail di "liver tx vintage problems(median, iqr):" r(p50) ", " r(p25) " - " r(p75) qui sum livertx_vintage if mobility == 1, detail di "liver tx vintage no problems(median, iqr):" r(p50) ", " r(p25) " - " r(p75) // P value comparison via chi square foreach x of varlist sex ethnicity2 education marital_status2 income2 cci_2cat diabetes{ qui tab `x' mobility, chi di "`x' chi p value:" r(p) } // Liver Dx cause has to be fisher as there are small cells tab livdx_cause mobility, exact // Man Whitney U for continuous variables foreach x of varlist age alb hgb livertx_vintage { ranksum `x', by(mobility) } // Validation // Marginal Reliability (1-mean(SE)^2) capture drop stderr_phys // drop old variable if present qui sum num_quest_phys_funct // generating the max # of questions local max = r(max) //storing the maximum number of questions qui gen stderr_phys = . // generate standard error variable (standard error of last question) qui foreach i of numlist 1/`max' { qui replace stderr_phys = std_error`i'_phys_funct if !mi(std_error`i'_phys_funct) } qui sum stderr_phys // mean of SE di "Average marginal reliability: " 1-(r(mean)^2) // Test retest reliability snapshot save // ICC needs a special structure (a row per observation so this messes up the data) expand 2 gen fu_time = date_of_v2_completion - doe drop if fu_time < 14 bysort mrn: gen tag = _n replace phys_tscore = phys_tscore_retest if tag == 2 drop if phys_tscore_retest == . icc phys_tscore mrn tag snapshot restore 1 // restore to savepoint snapshot erase _all // Construct Validity - Convergent (SF12 PCS, SF36 PF, EQ5D mobility) foreach var of varlist ldqol_pf ldqol_sf36_pf eq5d_1 { qui swilk `var' if r(p) > 0.05 { corr phys_tscore `var', sig } else { ci2 phys_tscore `var', spearman qui spearman phys_tscore `var' di "P value: " %5.3f r(p) } } // Construct validity - Known groups // CCI (using a cut off of >=4 because mod-severe liver disease = 3 points) capture drop cci_2cat gen cci_2cat = 1 if charlson_comorbidity_index < 4 replace cci_2cat = 2 if charlson_comorbidity_index >= 4 & !mi(charlson_comorbidity_index) label variable cci_2cat "Categorized CCI score >=4 and <4" label define cci_2cat 1 "<4" 2 ">=4", replace label values cci_2cat cci_2cat bysort cci_2cat: swilk phys_tscore //Normally Distributed sdtest phys_tscore, by(cci_2cat) //Equal variances ttest phys_tscore, by(cci_2cat) esize twosample phys_tscore, by(cci_2cat) // Sex (M>F) bysort sex: swilk phys_tscore sdtest phys_tscore, by(sex) ttest phys_tscore, by(sex) esize twosample phys_tscore, by(sex) // Older Adults (65+) capture drop age_youngold gen age_youngold = 1 if age <60 replace age_youngold = 2 if age >=60 & !mi(age) label variable age_youngold "Categorized age 65+" label define age_youngold 1 "<65" 2 ">=65", replace label values age_youngold age_youngold bysort age_youngold: swilk phys_tscore sdtest phys_tscore, by(age_youngold) ttest phys_tscore, by(age_youngold) esize twosample phys_tscore, by(age_youngold) // Anemia (<120 in women, <130 in men) gen anemia = 1 if (hgb <120 & sex == 2) | (hgb < 130 & sex == 1) replace anemia = 0 if !mi(hgb) & !mi(sex) & mi(anemia) label variable anemia "Anemia Status" label define anemia 1 "Anemic" 0 "Not Anemic", replace label values anemia anemia bysort anemia: swilk phys_tscore sdtest phys_tscore, by(anemia) ttest phys_tscore, by(anemia) esize twosample phys_tscore, by(anemia) // General Health (Excellent/Very Good) (ldqol_sf1) gen genhealth_2 = 1 if ldqol_sf1 <= 2 replace genhealth_2 = 0 if ldqol_sf1 >2 & !mi(ldqol_sf1) label variable genhealth_2 "General Health Categorized" label define genhealth_2 1 "Excellent/Very Good" 0 "Good/Fair/Poor", replace label values genhealth_2 genhealth_2 bysort genhealth_2: swilk phys_tscore sdtest phys_tscore, by(genhealth_2) ttest phys_tscore, by(genhealth_2) esize twosample phys_tscore, by(genhealth_2) // Mobility gen mobility = 1 if eq5d_1 == 1 replace mobility = 0 if eq5d_1 >1 & !mi(eq5d_1) // Alternative coding of mobility // gen mobility = 1 if eq5d_1 == 1 | eq5d_1 == 2 // replace mobility = 0 if eq5d_1 >2 & !mi(eq5d_1) label variable mobility "EQ5D Mobility Issues Categorized" label define mobility 1 "No Problems walking" 0 "Problems Walking", replace label values mobility mobility bysort mobility: swilk phys_tscore sdtest phys_tscore, by(mobility) ttest phys_tscore, by(mobility) esize twosample phys_tscore, by(mobility) // Discrimination capture drop mobility gen mobility = 1 if eq5d_1 == 1 replace mobility = 0 if eq5d_1 >1 & !mi(eq5d_1) label variable mobility "EQ5D Mobility Issues Categorized" label define mobility 1 "No Problems walking" 0 "Problems Walking", replace label values mobility mobility roctab mobility phys_tscore, graph // Calibration of a logistic model for patients with impaired mobility logistic mobility phys_tscore, or predict p, pr // pmcalplot phat mobility, ci // slight underfitting in lower range of predicted //get deciles of the score you are validating (here, PROMIS CAT Sleep Disturbance) xtile phys_tscore_10 = phys_tscore, nq(10) bysort phys_tscore_10: summarize p mobility phys_tscore, detail //generate predicted probabilities (p10) and observed probabilities (o10) of outcome, for each decile bysort phys_tscore_10: egen p10 = mean(p) bysort phys_tscore_10: egen o10 = mean(mobility) //remove observations with missing deciles or scores drop if mi(phys_tscore_10) | mi(p) | mi(p10) //sort and list everything, grouped by decile of score being validated sort phys_tscore list phys_tscore phys_tscore_10 p p10 o10, sepby(phys_tscore_10) //scatter and curve plot for calibration //since Stata cannot specify exact values using == here, you need to specify the ranges below based on what you get from the list command above //within each decile, pick the median slp_tscore and specify the range in which it lies so that only one point is plotted //change the axis labels as you like twoway (scatter o10 phys_tscore if (phys_tscore > 30.8 & phys_tscore < 31.1)|(phys_tscore > 36.2 & phys_tscore < 36.23)| /// (phys_tscore > 40.54 & phys_tscore < 40.55)|(phys_tscore > 42.12 & phys_tscore < 42.13)|(phys_tscore > 44.16 & phys_tscore < 44.17)| /// (phys_tscore > 46.77 & phys_tscore < 46.78)|(phys_tscore > 49.64 & phys_tscore < 49.65)|(phys_tscore > 52.60 & phys_tscore < 52.61)| /// (phys_tscore > 56.14 & phys_tscore < 56.15)|(phys_tscore > 62.37 & phys_tscore < 62.38), xtitle("PROMIS CAT Physical Function T scores (deciles)") /// ytitle("Probability of mobility problems") xsc(r(25 85)) xlabel(25(5)85)) (line p phys_tscore), legend(off) name(top, replace) //accompanying spikeplot egen cnt = count(1), by(phys_tscore mobility) replace cnt = -cnt if mobility == 0 replace cnt = . if mi(phys_tscore) //modify the y-label range accordingly for the spikeplot twoway spike cnt phys_tscore, yline(0) ytitle("Number of participants") ylabel( -5 "5" 0 5) xtitle("PROMIS CAT Physical Function scores") name(bottom, replace) //combine graphs graph combine top bottom, r(2) c(1) xcom name(all_spike, replace) // Coverage foreach x of varlist phys_tscore ldqol_pf ldqol_sf36_pf eq5d_1 { // drop temp variables in case they are still there for some reason capture drop min_val max_val total_count // Summarize descriptive stats and store in variable quietly sum `x' quietly gen min_val = r(min) quietly gen max_val = r(max) quietly gen total_count = r(N) // Count # of responses with min value quietly count if `x' == min_val // Divide number of responses by total. Display result di "`x' Floor: " %5.3f r(N)/total_count // Count # of responses with max value quietly count if `x' == max_val // Divide number of responses by total. Display result di "`x' Ceiling: " %5.3f r(N)/total_count // Drop temp variables quietly drop min_val max_val total_count } // Efficiency capture drop ctt_cnt gen ctt_cnt = 4 label variable ctt_cnt "Number of questions in PROMIS-57 PF" ttest phys_cnt == ctt_cnt drop ctt_cnt // Counting number of SF-12 questions completed egen ldqol_pf_miss = rownonmiss(ldqol_sf1 ldqol_sf3b ldqol_sf3d ldqol_sf4b ldqol_sf4c ldqol_sf5b /// ldqol_sf5c ldqol_sf8 ldqol_sf9d ldqol_sf9e ldqol_sf9f ldqol_sf10) replace ldqol_pf_miss = . if ldqol_pf_miss ==0 sum ldqol_pf_miss ttest phys_cnt == ldqol_pf_miss egen ldqol_pf36_miss = rownonmiss(ldqol_sf1-ldqol_sf11d) replace ldqol_pf36_miss = . if ldqol_pf36_miss == 0 ttest phys_cnt == ldqol_pf36_miss // Spline Plots cd "U:\Student Folders\Evan\LiverTx Validation\graphs" // PROMIS vs SF-12 twoway (fpfitci phys_tscore ldqol_pf if age<100, /// ylab(20(20)80) xlab(15(10)60) xtitle("SF-12 PCS") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score")) // PROMIS vs SF-36 twoway (fpfitci phys_tscore ldqol_sf36_pf if age<100, /// ylab(20(20)80) xlab(15(10)60) xtitle("SF-36 PCS") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score")) graph save "Spline_SF36", replace graph export "Spline_SF36.tif", width(2550) replace // PROMIS vs albumin twoway (fpfitci phys_tscore alb if age<100, /// ylab(20(20)80) xlab(25(10)55) xtitle("Albumin") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score") legend(off)) graph save "Spline_PROMIS_alb", replace graph export "Spline_PROMIS_alb.tif", width(2550) replace // SF12 vs albumin twoway (fpfitci ldqol_pf alb if age<100, /// ylab(15(10)70) xlab(25(10)55) xtitle("Albumin") /// ciplot(rline) ytitle("SF-12 PCS") legend(off)) graph save "Spline_SF_alb", replace graph export "Spline_SF_alb.tif", width(2550) replace // PROMIS vs hgb twoway (fpfitci phys_tscore hgb if age<100, /// ylab(20(20)80) xlab(80(10)185) xtitle("Hemoglobin") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score") legend(off)) graph save "Spline_PROMIS_hb", replace graph export "Spline_PROMIS_hb.tif", width(2550) replace // SF12 vs hgb twoway (fpfitci ldqol_pf hgb if age<100, /// ylab(15(10)70) xlab(80(10)185) xtitle("Hemoglobin") /// ciplot(rline) ytitle("SF-12 PCS") legend(off)) graph save "Spline_SF_hb", replace graph export "Spline_SF_hb.tif", width(2550) replace // PROMIS vs CCI twoway (fpfitci phys_tscore charlson_comorbidity_index if age<100, /// ylab(20(20)80) xlab(0(1)12) xtitle("CCI") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score") legend(off)) graph save "Spline_PROMIS_CCI", replace graph export "Spline_PROMIS_CCI.tif", width(2550) replace // SF vs CCI twoway (fpfitci ldqol_pf charlson_comorbidity_index if age<100, /// ylab(15(10)70) xlab(0(1)12) xtitle("CCI") /// ciplot(rline) ytitle("SF-12 PCS") legend(off)) graph save "Spline_SF_CCI", replace graph export "Spline_SF_CCI.tif", width(2550) replace // PROMIS vs age twoway (fpfitci phys_tscore hgb if age<100, /// ylab(20(20)80) xlab(80(10)185) xtitle("Age") /// ciplot(rline) ytitle("PROMIS Physical Function T-Score") legend(off)) graph save "Spline_PROMIS_age", replace graph export "Spline_PROMIS_age.tif", width(2550) replace // SF12 vs age twoway (fpfitci ldqol_pf hgb if age<100, /// ylab(15(10)70) xlab(80(10)185) xtitle("Age") /// ciplot(rline) ytitle("SF-12 PCS") legend(off)) graph save "Spline_SF_age", replace graph export "Spline_SF_age.tif", width(2550) replace // PROMIS vs SF-12 between mobility groups twoway fpfitci phys_tscore ldqol_pf if age<100, ylab(0(10)100) xlab(10(10)60) /// xtitle("SF-12 PCS") ciplot(rline) by(mobility, note("") legend(off)) /// ytitle("PROMIS Physical Function T-Score") // PROMIS vs SF-12 between cci_groups twoway fpfitci phys_tscore ldqol_pf if age<100, ylab(0(10)100) xlab(10(10)60) /// xtitle("SF-12 PCS") ciplot(rline) by(cci_2cat, note("") legend(off)) /// ytitle("PROMIS Physical Function T-Score") graph save "Spline_SF12_CCI", replace graph export "Spline_SF12_CCI.tif", width(2550) replace // PROMIS vs SF-12 between sex twoway fpfitci phys_tscore ldqol_pf if age<100, ylab(0(10)100) xlab(10(10)60) /// xtitle("SF-12 PCS") ciplot(rline) by(sex, note("") legend(off)) /// ytitle("PROMIS Physical Function T-Score") graph save "Spline_SF12_CCI", replace graph export "Spline_SF12_CCI.tif", width(2550) replace // PROMIS vs SF-12 between age twoway fpfitci phys_tscore ldqol_pf if age<100, ylab(0(10)100) xlab(10(10)60) /// xtitle("SF-12 PCS") ciplot(rline) by(age_youngold, note("") legend(off)) /// ytitle("PROMIS Physical Function T-Score") graph save "Spline_SF12_CCI", replace graph export "Spline_SF12_CCI.tif", width(2550) replace // MCID // Distribution based sum phys_tscore, detail di "Half SD: " %5.3f r(sd)/2 // Anchor based (cross sectional) // Define program program define mid args varname gsGroups numGroups // varname = variable that requires determination of MID (ie Promis depression) // gsGroups = gold standard variable (anchor). Note: must be categorical (ie PHQ) // numGroups = number of groups in gold standard variable forvalues j = 1/`numGroups' { qui sum `varname' if `gsGroups' == `j' // Summarize promis score for both groups local mean_combined_`j' = r(mean) } local mean_mid_combined = abs(`mean_combined_`numGroups'' - `mean_combined_1')/(`numGroups'-1) di "MID for `varname': "`mean_mid_combined' /* MID formula: for a range of groups from 1 to n. MID = (Xn-X1)/n-1 (x2-x1) + (x3-x2) + (x4-x3) / (4-1) (-x1) + (x4) / 3 */ end // Anchor 1 EQ5D mobility categories mid phys_tscore eq5d_1 4 // Anchor 2 Global01 (General Health) mid phys_tscore global01 5 // Anchor 3 SF36- General Health Quintiles xtile genhealth_5 = ldqol_sf36_gh, n(5) // quintiles of SF36 general health mid phys_tscore genhealth_5 5 drop genhealth_5 // Comparing SF-12 PCS to PROMIS PF CAT (DV = EQ5D Mobility) // Base model (unadjusted) qui ologit eq5d_1 phys_tscore qui fitstat, sav(promis_base) qui ologit eq5d_1 ldqol_pf fitstat, using(promis_base) force // current = SF12, saved = promis // Age and Sex adjusted model qui ologit eq5d_1 phys_tscore age sex qui fitstat, sav(promis_base) qui ologit eq5d_1 ldqol_pf age sex fitstat, using(promis_base) force // current = SF12, saved = promis // Physical Function in relation to time after transplant // Variables // Relation between Multiple Transplants and Physical Function // Variables // Multiple Transplants gen liver_transplant_num = 1 if !mi(liver_transplant_1) //Number of liver transplants = 1 if first transplant date is present replace liver_transplant_num = 2 if !mi(lvier_transplant_2) // Number of liver transplants = 2 if second transplant date is present label variable liver_transplant_num "Number of Liver Transplants" // Label Variable // Comparison of physical function based on # of transplants bysort liver_transplant_num: sum phys_tscore, detail // looking at score distribution between 2 groups ttest phys_tscore, by(liver_transplant_num) // Ttest between 2 groups graph box phys_tscore, over(liver_transplant_num) // Boxplot looking at distribution between 2 groups // Relation between CCI and Physical Function // Comparison of CCI and Physical Function twoway (scatter phys_tscore charlson_comorbidity_index , jitter(10) ) (lfit phys_tscore charlson_comorbidity_index) // Scatterplot spearman phys_tscore charlson_comorbidity_index // Spearman Correlation // Questions to Explore // Does having multiple transplants affect your physical function // Does time from transplant relate to physical function // Can use ML to find the clinical correlates of PF log close