Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Restricted cubic spline graph

    Hello everyone,

    I'm trying to investigating if the time from diagnosis of a distinct disease have an impact on my interest outcome (being treated with the drug X) with a multivariable logistic regression model. (code below). N.B I'm working on a m=10 imputed dataset.

    mi estimate, eform post: logit X timefromdiagnosis i.sex i.age_cat i.family i.inY i.child i.income i.edu i.AF i.IHD i.hypertension i.diabetes i.valdis i.revascular i.copd i.strokeT i.depression i.dementia i.PAD i.smok i.obesity i.NYHA_dic i.lvef i. HR i.device i.gfr i.NTproBNP i.anemia i.dyskalemia i.BB i.mra i.diuretic i.nitrate i.digox i.AC i.MAP i.statin i.antpl

    I've performed some models with the time from diagnosis specified as categorical variable as above, but even if it's more useful for practical purposes it doesn't help me that much in results

    Now I'm trying to run the same model but with time expressed as restricted cubic spline ( I don't want to limitate my analysis to a linear assumption).
    Therefore I've created the variable with 4 knots as below

    *knots
    mkspline timefromdiagnosisspline = days_diagnosis, nknots(4) cubic displayknots

    mat knots_timefromk = r(knots)


    and then run the model again

    mi estimate, eform post: logit X timefromdiagnosisspline i.sex i.age_cat i.family i.inY i.child i.income i.edu i.AF i.IHD i.hypertension i.diabetes i.valdis i.revascular i.copd i.strokeT i.depression i.dementia i.PAD i.smok i.obesity i.NYHA_dic i.lvef i. HR i.device i.gfr i.NTproBNP i.anemia i.dyskalemia i.BB i.mra i.diuretic i.nitrate i.digox i.AC i.MAP i.statin i.antpl
    testparm timefromdiagnosisspline1 timefromdiagnosisspline2 timefromdiagnosisspline3

    Now I'd like to present the variation of OR with 95%CI of receiving drug X as function of time change like the graph below. How can I do this? Marginplot / margin doesn't work with mi estimate
    Click image for larger version

Name:	Screenshot 2023-11-02 at 13.00.38.png
Views:	1
Size:	119.5 KB
ID:	1732432


    ​​​​​​​Thanks a lot everyone for helping me out
Working...
X