Hi i would like to produce a a forest plot for my subgroup analysis for clinical trial data.
I would like a forest plot that has a p-values for interaction column.
An using the following command:
ipdover, over( age_binary FacilityxVL2 sinceHIVDxtime_cat marital_binary education_binary hours_cat2 phone_own3 phonenoshare ///
PregnancyOutcome Gestcat previousHIVDx Year_ENROLLMENTDATE2) ///
or forestplot( (null xlabel( 0.10 (1) 10, force) boxsca(100) textsize(150) ) ///
favours("Odds of VL testing decrease" "without SMS" # "Odds of VL testing increase" "with SMS") fp(7)) ///
lcols((sum) gap33_binaryinteraction0 arm20 gap33_binaryinteraction1 arm21 ) saving(test33.dta, replace): logit gap33_binary arm2 if gap33b==1
use test33, clear
gen prev0 = string(gap33_binaryinteraction1) + "/" + string(arm21) + " (" + string(100*gap33_binaryinteraction1/arm21, "%4.1f") + ")" if !missing(arm21)
gen prev1 = string(gap33_binaryinteraction0) + "/" + string(arm20) + " (" + string(100*gap33_binaryinteraction0/arm20, "%4.1f") + ")" if !missing(arm20)
label variable prev0 "VL test in SMS arm (%)"
label variable prev1 "VL test in control arm (%)"
gen pval = .
forvalues i= 1 /12 {
replace pval = `pval`i'' if _USE==0 & _OVER==`i'
}
*** at this point I get an error message as below and therefore cannot rum the rest of command
. replace pval = `pval`i'' if _USE==0 & _OVER==`i'
if not found
r(111);
end of do-file
****
format %05.3f pval
I go ahead and rum the command below with missing pvalues generate as above
gen pvalstr = string(pval, "%05.3f")
format %11s pvalstr // since there are 11 letters in the word "interaction"
label var pvalstr "p-value for interaction"
forestplot, rr lcols(prev0 prev1) rcols(pvalstr)
I get attached graph
Thank you for your help
Winfred
. dataex clinic_id gap33_binary arm2 age_binary marital_binary education_binary FacilityxVL2 sinceHIVDxtime_cat hours_cat2 phone_own3 phoneno
> share Gestcat PregnancyOutcome Year_ENROLLMENTDATE2 in 1/20
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
I would like a forest plot that has a p-values for interaction column.
An using the following command:
ipdover, over( age_binary FacilityxVL2 sinceHIVDxtime_cat marital_binary education_binary hours_cat2 phone_own3 phonenoshare ///
PregnancyOutcome Gestcat previousHIVDx Year_ENROLLMENTDATE2) ///
or forestplot( (null xlabel( 0.10 (1) 10, force) boxsca(100) textsize(150) ) ///
favours("Odds of VL testing decrease" "without SMS" # "Odds of VL testing increase" "with SMS") fp(7)) ///
lcols((sum) gap33_binaryinteraction0 arm20 gap33_binaryinteraction1 arm21 ) saving(test33.dta, replace): logit gap33_binary arm2 if gap33b==1
use test33, clear
gen prev0 = string(gap33_binaryinteraction1) + "/" + string(arm21) + " (" + string(100*gap33_binaryinteraction1/arm21, "%4.1f") + ")" if !missing(arm21)
gen prev1 = string(gap33_binaryinteraction0) + "/" + string(arm20) + " (" + string(100*gap33_binaryinteraction0/arm20, "%4.1f") + ")" if !missing(arm20)
label variable prev0 "VL test in SMS arm (%)"
label variable prev1 "VL test in control arm (%)"
gen pval = .
forvalues i= 1 /12 {
replace pval = `pval`i'' if _USE==0 & _OVER==`i'
}
*** at this point I get an error message as below and therefore cannot rum the rest of command
. replace pval = `pval`i'' if _USE==0 & _OVER==`i'
if not found
r(111);
end of do-file
****
format %05.3f pval
I go ahead and rum the command below with missing pvalues generate as above
gen pvalstr = string(pval, "%05.3f")
format %11s pvalstr // since there are 11 letters in the word "interaction"
label var pvalstr "p-value for interaction"
forestplot, rr lcols(prev0 prev1) rcols(pvalstr)
I get attached graph
Thank you for your help
Winfred
. dataex clinic_id gap33_binary arm2 age_binary marital_binary education_binary FacilityxVL2 sinceHIVDxtime_cat hours_cat2 phone_own3 phoneno
> share Gestcat PregnancyOutcome Year_ENROLLMENTDATE2 in 1/20
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str14 clinic_id float(gap33_binary arm2 age_binary marital_binary education_binary FacilityxVL2 sinceHIVDxtime_cat hours_cat2 phone_own3 phonenoshare Gestcat PregnancyOutcome Year_ENROLLMENTDATE2) "K2123" 0 0 0 1 0 3 2 1 1 0 2 0 0 "K2123" 0 0 0 1 0 3 2 1 1 0 2 0 0 "K2140" 1 0 0 1 0 3 3 0 1 1 2 0 0 "K2140" 1 0 0 1 0 3 3 0 1 1 2 0 0 "K2140" 1 0 0 1 0 3 3 0 1 1 2 0 0 "K2200" 0 0 1 1 0 3 1 1 1 0 3 0 0 "K2200" 0 0 1 1 0 3 1 1 1 0 3 0 0 "K2183" 0 1 1 1 1 3 1 1 1 0 2 0 0 "K2185" 1 0 1 0 1 3 3 1 1 1 2 0 0 "K2185" 1 0 1 0 1 3 3 1 1 1 2 0 0 "K2185" 1 0 1 0 1 3 3 1 1 1 2 0 0 "K2185" 1 0 1 0 1 3 3 1 1 1 2 0 0 "K2111" 0 0 1 1 0 3 2 1 1 0 2 0 0 "K2150" 1 0 1 1 1 3 3 1 1 1 2 0 0 "K2150" 1 0 1 1 1 3 3 1 1 1 2 0 0 "K2150" 1 0 1 1 1 3 3 1 1 1 2 0 0 "C3044" 0 0 1 1 0 1 2 1 1 0 2 1 0 "M5166" 1 0 1 0 1 2 1 1 1 1 1 0 0 "M5166" 1 0 1 0 1 2 1 1 1 1 1 0 0 "M5166" 1 0 1 0 1 2 1 1 1 1 1 0 0 end label values arm2 arm2_label label def arm2_label 0 "Control", modify label def arm2_label 1 "sms", modify label values age_binary age_binary_label label def age_binary_label 0 "≥30 years", modify label def age_binary_label 1 "<30 years", modify label values marital_binary marital_binary_label label def marital_binary_label 0 "Not in union", modify label def marital_binary_label 1 "Married", modify label values education_binary education_binary_label label def education_binary_label 0 "No", modify label def education_binary_label 1 "Yes", modify label values FacilityxVL2 FacilityxVL2_label label def FacilityxVL2_label 1 "Chulaimbo/Matayos", modify label def FacilityxVL2_label 2 "MTRH", modify label def FacilityxVL2_label 3 "Kitale", modify label values sinceHIVDxtime_cat sinceHIVDxtime_cat_label label def sinceHIVDxtime_cat_label 1 "<1 year", modify label def sinceHIVDxtime_cat_label 2 "1-5 years", modify label def sinceHIVDxtime_cat_label 3 ">5 years", modify label values hours_cat2 hours_cat2_label label def hours_cat2_label 0 ">1hr", modify label def hours_cat2_label 1 "≤1hr", modify label values phone_own3 phone_own3_label label def phone_own3_label 1 "Yes", modify label values phonenoshare phonenoshare_label label def phonenoshare_label 0 "Yes", modify label def phonenoshare_label 1 "No", modify label values Gestcat Gestcat_label label def Gestcat_label 1 "First", modify label def Gestcat_label 2 "Second", modify label def Gestcat_label 3 "Third", modify label values PregnancyOutcome PregnancyOutcome_label label def PregnancyOutcome_label 0 "Live birth", modify label def PregnancyOutcome_label 1 "loss/unknown", modify label values Year_ENROLLMENTDATE2 Year_ENROLLMENTDATE2_label label def Year_ENROLLMENTDATE2_label 0 "2016", modify
