I'm trying to generate a forest plot to demonstrate how various parameters from my regression analysis differ between men and women.
The project is looking at whether various clinical parameters like age, hypertension, diabetes, BMI, etc. affect the outcome AFEQT which is a score that measures quality of life.
A simplified dataset of the first 40 patients:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(afeqt age) byte(hypertension diabetes) float(vasculardisease crcl chadsvasc bmi rhythmdrug oac antiplatelet) byte(congestiveheartfailure bb calchannelbloc digoxin) 64.81481 55 0 1 0 153.9977 2 35.323524 0 1 0 1 1 0 0 91.66666 77 1 0 1 56.35637 4 27.544733 0 1 0 0 1 0 0 72.22222 79 1 0 0 33.952496 7 28.57329 0 1 1 1 1 0 0 100 77 0 0 0 72.99168 2 27.373625 0 1 0 0 1 0 0 79.62963 78 1 0 1 61.5 4 24.772097 0 1 1 0 1 0 0 37.962963 81 1 0 1 38.18076 8 23.82916 0 1 0 1 1 0 0 96.2963 69 0 0 0 79.55825 2 22.445824 0 1 0 0 1 0 0 63.88889 70 1 1 0 108.94717 3 29.22392 0 0 1 0 1 0 0 64.81481 72 0 1 0 98.37205 2 31.07772 0 0 1 0 1 0 0 74.07407 74 0 0 0 72.941864 1 22.57786 0 1 0 0 0 1 0 62.03704 68 1 0 0 95.25581 2 35.882004 0 1 0 0 0 1 0 58.33333 67 1 0 0 75.505226 2 28.424456 1 1 0 0 0 0 0 50 64 1 0 1 99.31015 3 32.370907 1 1 1 1 1 0 0 84.25926 69 1 0 0 88.87273 3 30.64095 0 1 0 0 1 0 0 96.2963 71 0 0 0 96.22147 1 30.10786 0 1 0 0 0 0 0 76.85185 79 1 0 0 34.100143 4 29.901335 0 1 0 0 1 0 0 91.66666 69 0 1 0 101.86906 4 35.135067 0 1 0 0 1 0 0 88.88889 67 0 0 0 71.09472 1 24.044525 0 1 0 0 0 0 0 70.37037 78 0 0 0 57.93658 3 28.383005 0 1 0 0 1 0 0 91.66666 71 1 0 1 73.07754 3 28.98243 0 1 0 0 1 0 0 45.37037 64 1 0 0 . 1 34.397705 0 1 0 0 1 0 0 98.14815 71 1 0 0 76.68307 3 30.28442 0 1 1 0 1 0 0 75 76 1 0 0 63.91129 3 23.907375 0 1 1 0 1 0 0 76.85185 73 1 0 0 63.114 2 32.21504 0 1 1 0 1 0 0 74.07407 69 0 0 0 85.53426 1 24.59934 1 1 0 0 0 0 0 33.333332 76 1 0 1 52.06596 5 26.27184 0 1 0 0 0 1 1 87.03704 77 0 0 0 67.62763 2 20.412403 0 1 0 0 1 0 0 34.313725 65 1 0 0 92.79993 3 41.1392 0 0 0 1 1 0 0 75 72 1 0 1 57.02727 3 24.26126 0 1 0 0 1 0 0 92.59259 61 0 0 0 181.2028 0 43.49055 0 0 1 0 0 0 0 37.037037 88 0 0 0 29.49818 4 21.99418 0 1 0 1 0 1 0 84.25926 42 0 0 0 138.6276 0 28.148363 0 0 0 0 0 0 0 94.44444 83 1 0 0 65.61096 3 31.99715 0 1 0 0 0 0 0 62.03704 47 1 0 0 96.06869 2 28.62828 0 0 1 0 1 0 0 66.666664 81 1 0 0 81.4113 4 42.27281 0 1 0 0 1 0 0 77.77778 62 0 0 0 57.82314 1 22.320356 0 0 1 0 1 0 0 66.666664 66 0 1 0 166.3421 3 38.8543 0 1 0 0 1 0 0 100 60 0 0 0 78.8052 0 26.60024 0 0 0 0 0 0 0 75.92593 66 1 0 0 113.95592 3 39.40623 0 1 0 0 0 1 0 76.47059 77 0 0 0 40.61157 3 20.0108 0 0 0 0 0 1 1 end
I ended up using the -parmby- command and got very close to what I want to do
Code:
parmby /*exclude gender*/ "qui regress afeqt age hypertension diabetes vasculardisease crcl chadsvasc bmi rhythmdrug oac antiplatelet congestiveheartfailure bb calchannelbloc digoxin" , label by(gender) list(parm estimate min95 max95 p) for(parm estimate min95 max95 p) saving(1bboth, replace) use 1bboth.dta, clear sort parmseq gender drop stderr dof t label drop if parm == "_cons" sencode parm, replace
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(gender parmseq parm) double(estimate p min95 max95) 0 1 1 5.086905829051259 4.897179434192084e-06 2.9154336133007996 7.258378044801718 1 1 1 1.118290765295838 .12622779418356767 -.3154188991475627 2.552000429739239 0 2 2 1.8264187612953007 .3481864106058541 -1.9926713358000365 5.645508858390638 1 2 2 -.5611854841601627 .6668597130319962 -3.1178996516889104 1.995528683368585 0 3 3 3.0545861969340984 .11013041155045325 -.6941945152858384 6.803366909154035 1 3 3 -1.594536005507197 .18946263110971293 -3.9770983060407294 .7880262950263353 0 4 4 -1.9033137656950854 .38952003628029663 -6.242391479758064 2.4357639483678937 1 4 4 -2.530994411878184 .0718726054926382 -5.28730553877149 .22531671501512118 0 5 5 3.1122628346811316 .33529528144912457 -3.2239822494664976 9.448507918828762 1 5 5 .20600339448279192 .915211859257036 -3.5887396225862727 4.000746411551857 0 6 6 -1.3602122264843357 .15479114365716293 -3.2349161319220467 .5144916789533753 1 6 6 -.22276295484999034 .7216188895544912 -1.4489214191938855 1.0033955094939049 0 7 7 -3.767690016686675 .0024240111539585263 -6.198968993400359 -1.3364110399729912 1 7 7 -1.1079537067120824 .2558173606408489 -3.019774567505154 .803867154080989 0 8 8 -4.617262350065326 .05815309529463343 -9.394310384880445 .15978568474979316 1 8 8 -4.270291550832077 .008493453560458757 -7.448861491217555 -1.0917216104465992 0 9 9 -.46013446627579807 .8247031301604013 -4.536080954714526 3.6158120221629297 1 9 9 2.429428269272792 .08070771778511472 -.29714302973427165 5.1559995682798565 0 10 10 -2.7154843054761724 .15857119060512237 -6.492411385844662 1.061442774892317 1 10 10 .9504277395480225 .42059703797831893 -1.363726330541734 3.2645818096377788 0 11 11 -4.046823260258118 .07631506472106718 -8.522594106958625 .42894758644238973 1 11 11 -7.660353836714247 1.3735767190603572e-06 -10.759617162642957 -4.5610905107855375 0 12 12 1.0099417638616521 .48485608166806127 -1.826570390320553 3.8464539180438573 1 12 12 -2.3378301013135867 .015254921823288997 -4.225713365844751 -.44994683678242264 0 13 13 -1.4851424755051694 .3085731862654626 -4.346166687720291 1.3758817367099516 1 13 13 -.7229578438872653 .4860228840013059 -2.758069535888736 1.3121538481142057 0 14 14 -1.594072008404671 .42839227285613024 -5.542810705772276 2.3546666889629346 1 14 14 -1.2547403465926525 .3712307601983178 -4.006433202680241 1.496952509494936 end label values gender gender label def gender 0 "female", modify label def gender 1 "male", modify label values parm parm label def parm 1 "age (per 10 year change)", modify label def parm 2 "hypertension", modify label def parm 3 "diabetes", modify label def parm 4 "vasculardisease", modify label def parm 5 "CrCl (per 10 unit change)", modify label def parm 6 "chadsvasc", modify label def parm 7 "BMI (per 10 point change)", modify label def parm 8 "rhythmdrug", modify label def parm 9 "oac", modify label def parm 10 "antiplatelet", modify label def parm 11 "congestiveheartfailure", modify label def parm 12 "bb", modify label def parm 13 "calchannelbloc", modify label def parm 14 "digoxin", modify
Code:
eclplot estimate min95 max95 parm, horizontal xtitle("coefficient") ylabel(1(1)14) supby(gender, spaceby(0.3))
What I would really like to do is highlight the terms were the interaction is significant. I can go back to my original dataset and run the interaction analyses but I was hoping there was a more efficient way to run this type of analysis, or some other command I could use that I am not aware of. It was a little tedious to generate a new dataset with parmby and have to go back to my original dataset to run the interaction analyses.
Thanks in advance for the assistance.
Chris Labos
0 Response to Forest plot of sub-groups and testing for interaction
Post a Comment