0
$\begingroup$

I have a dataset that looks somewhat similar to this:

> dput(df)
structure(list(Death = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Insurance = c("Medicaid", 
"Private", "Private", "Private", "Medicaid", "Private", "Private", 
"Private", "Medicaid", "Medicaid", "Private", "Private", "Private", 
"Private", "Medicaid", "Medicaid", "Medicaid", "Private", "Medicaid", 
"Private", "Private", "Medicaid"), Race = c("White", "Black", 
"Asian", "White", "Black", "Black", "Black", "Asian", "White", 
"Asian", "Black", "Asian", "Asian", "Asian", "White", "Black", 
"White", "Black", "White", "Asian", "Asian", "White"), Sex = c("Female", 
"Female", "Female", "Male", "Female", "Male", "Male", "Male", 
"Female", "Male", "Female", "Male", "Female", "Female", "Male", 
"Female", "Male", "Male", "Female", "Male", "Male", "Female"), 
    Surgery.Type = c("Cardiac", "Oncology", "General", "Cardiac", 
    "Cardiac", "General", "Orthopedics", "Orthopedics", "Cardiac", 
    "Orthopedics", "Cardiac", "Oncology", "Orthopedics", "General", 
    "Oncology", "Cardiac", "General", "Oncology", "General", 
    "Orthopedics", "Cardiac", "Oncology")), class = "data.frame", row.names = c(NA, 
-22L))

I want to look at the relationship between socioeconomic variables (insurance type, race, sex) on the outcome death. The surgery type surely impacts this, since some surgery types are riskier than others (etc. oncology). Would it make sense to treat Surgery.Type as a random effect?

If so, would it make sense to write the model like this:

mylogit <- glmer(
  Death ~  Insurance + Race +
    Sex + (1|Surgery.Type),
  data = df,
  family = "binomial"
)
$\endgroup$
1
  • $\begingroup$ Why you relate impact factors to random? Sex & race may also change risk of death $\endgroup$ Nov 22, 2022 at 20:28

1 Answer 1

1
$\begingroup$

No. It would not make sense to treat surgery as a random effect.

A conceptual springboard to understanding random effects is not to think of them as a single variable, but rather as an ID that links (clusters) observations according to several unmeasured variables.

In your surgery dataset, the ideal random effect, for instance, would be a patient identifier for patients/healthcare subscribers who utilize several surgeries. Consider that that person has several highly predictive variables such as their economic status, functional status, comorbidities, etc. etc. clearly not collected in the data, but their individual outcome is highly predicted by these factors. There would be potentially 30 or more patients in such an analysis, and a fixed effect for each would clearly lead to a Neyman Scott problem.

Even though your stated objectives are to compare sex, race, and insurance to mortality, this does not mean that the other variable(s) are relegated to random effects. The impact of "adjusting" for subsequent variables is much the same, regardless of whether they're fixed or random effects - the modeled association is considered conditional - as opposed to marginal. For instance, in a model adjusting for race, sex, and surgery type, the effect of black race would be an odds ratio comparing those of black race to white race having the same sex, insurance type, and surgery.

Surgery has only 4 levels, it makes much more sense to adjust for surgery using a fixed effect.

$\endgroup$
3
  • $\begingroup$ Thank you, that makes sense. In the real dataset, surgery actually has around 30 levels. There is also a variable called procedure that describes the exactly procedure that the patient underwent. Would it still make more sense to treat service and/or procedure as a fixed effect in the logistic regression and control for those variables? Thanks again! $\endgroup$
    – Jamie
    Nov 22, 2022 at 22:17
  • $\begingroup$ I just saw that I have a patient ID number too in the dataset. Any thoughts on if I should include that? $\endgroup$
    – Jamie
    Nov 22, 2022 at 22:19
  • 1
    $\begingroup$ @Nat To expand, I'm going to assume you have N>10,000. I should think reviewers would expect to see surgery as a fixed effect regardless - detailed aspects of the surgery (procedure codes) should probably not be adjusted for. PatientID I would expect as a random effect. SurgeonID on the other hand could be a random effect. Healthcare facility could go both ways. - fixed or random. But what do I know? I think it sounds like a project in need of expert hands-on statistical help. $\endgroup$
    – AdamO
    Nov 22, 2022 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.