Hello,
I am am trying to find the right code to do a mixed effect binomial regression to give the relative risk of an outcome, but I am struggling to find the right mixed effect model.
I essentially want binreg picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num c.log_pim2 i.epoch, rr with a random intercept by patientid. This is because my outcome is death and the same patient is captured multiple times in the dataset with only the final admission having the potential to result in death so I want to account for this.
I unsuccessfully tried the following work arounds
gllamm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num i.epoch, rr i(patientid) fam(binomial) link(log)
factor-variable and time-series operators not allowed
xi: gllamm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num i.epoch log_pim2, i(patientid) fam(binomial) link(log)
i.cpi_poprank~e _Icpi_popra_1-5 (naturally coded; _Icpi_popra_1 omitted)
i.ethnic_cat _Iethnic_ca_1-5 (naturally coded; _Iethnic_ca_1 omitted)
i.age_cat _Iage_cat_1-5 (naturally coded; _Iage_cat_1 omitted)
i.sex _Isex_1-2 (naturally coded; _Isex_1 omitted)
i.season _Iseason_1-2 (naturally coded; _Iseason_1 omitted)
i.primarydiag~m _Iprimarydi_1-6 (naturally coded; _Iprimarydi_1 omitted)
i.epoch _Iepoch_1-3 (naturally coded; _Iepoch_1 omitted)
estimates diverging
From doing some reading my understanding is that the following code mixed effects generalised linear model with poisson family gives an approximation of relative risk
meglm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num c.log_pim2 i.epoch || patientid:, family(poisson) link(log) eform
However this does not give RR as an output but IRR
I would be really grateful for any advice on whether this is the best approach or if there are any other alternative methods for making a mixed effects binomial regression model.
Many thanks
Hannah
I am am trying to find the right code to do a mixed effect binomial regression to give the relative risk of an outcome, but I am struggling to find the right mixed effect model.
I essentially want binreg picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num c.log_pim2 i.epoch, rr with a random intercept by patientid. This is because my outcome is death and the same patient is captured multiple times in the dataset with only the final admission having the potential to result in death so I want to account for this.
I unsuccessfully tried the following work arounds
gllamm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num i.epoch, rr i(patientid) fam(binomial) link(log)
factor-variable and time-series operators not allowed
xi: gllamm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num i.epoch log_pim2, i(patientid) fam(binomial) link(log)
i.cpi_poprank~e _Icpi_popra_1-5 (naturally coded; _Icpi_popra_1 omitted)
i.ethnic_cat _Iethnic_ca_1-5 (naturally coded; _Iethnic_ca_1 omitted)
i.age_cat _Iage_cat_1-5 (naturally coded; _Iage_cat_1 omitted)
i.sex _Isex_1-2 (naturally coded; _Isex_1 omitted)
i.season _Iseason_1-2 (naturally coded; _Iseason_1 omitted)
i.primarydiag~m _Iprimarydi_1-6 (naturally coded; _Iprimarydi_1 omitted)
i.epoch _Iepoch_1-3 (naturally coded; _Iepoch_1 omitted)
estimates diverging
From doing some reading my understanding is that the following code mixed effects generalised linear model with poisson family gives an approximation of relative risk
meglm picu_mort i.cpi_poprank_quintile i.ethnic_cat i.age_cat i.sex i.season i.primarydiag_num c.log_pim2 i.epoch || patientid:, family(poisson) link(log) eform
However this does not give RR as an output but IRR
I would be really grateful for any advice on whether this is the best approach or if there are any other alternative methods for making a mixed effects binomial regression model.
Many thanks
Hannah
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(picu_mort cpi_poprank_quintile ethnic_cat age_cat sex season) long primarydiag_num float(log_pim2 epoch) long patientid 0 2 1 3 2 1 2 -3.5771534 1 11 0 2 1 3 2 1 2 -1.1086035 1 11 0 . 4 5 1 2 4 -2.7487965 2 18 0 . 4 5 1 2 4 -5.116813 2 18 0 . 4 5 1 1 6 -1.9823108 2 18 1 . 4 5 1 1 4 -3.421944 2 18 0 5 1 2 1 1 6 -4.244526 1 21 0 2 1 2 2 1 1 -3.6874056 1 31 0 . 1 5 2 1 6 -3.5771534 1 42 0 2 1 2 1 1 1 -3.039826 1 52 end label values picu_mort picu_mort label def picu_mort 0 "alive", modify label def picu_mort 1 "dead", modify label values ethnic_cat ethnic_cat label def ethnic_cat 1 "Any White", modify label def ethnic_cat 4 "Any Black", modify label values age_cat age_cat label def age_cat 2 "29 days to 1 year", modify label def age_cat 3 "1-4 years", modify label def age_cat 5 "11-15 years", modify label values sex sex label def sex 1 "Male", modify label def sex 2 "Female", modify label values season season label def season 1 "Winter", modify label def season 2 "Summer", modify label values primarydiag_num primarydiag_num label def primarydiag_num 1 "Cardiovascular", modify label def primarydiag_num 2 "Gastrointestinal", modify label def primarydiag_num 4 "Neurological", modify label def primarydiag_num 6 "Respiratory", modify
Comment