3
$\begingroup$

I have a dataset (data.mrsa) about the MRSA prevalence of elderly in long term care facilities (LTCF) with the following information:

  • mrsa_result: MRSA result of recruited elderly (positive VS negative)
  • age: residents' age
  • ltcf: UID for each LTCF (we sampled 30 out of 1000 LTCFs)
  • ltcf_type: type of LTCF (private VS non-private)

I have a multi-level logistic regression model like the one below:

fit2 <- glmer(mrsa_result ~ age + (1|ltcf), family=binomial("logit"),data=data.mrsa)

I know I am trying to find out the effect of age on the log-odds of mrsa_result, having the ltcf on the 2nd level gives me a wider CI on the lod-odds.

Now I want to add the ltcf_type into the model, I think this should be a fixed effect, as there can only be private and non-private, but itcf_type should be considered as 2nd level data, right? As this describe the type of LTCF, not the type of elderly.

I am puzzled on where should I put the term ltcf_type into my model, I wonder which of the following lines is correct:

fit2a <- glmer(mrsa_result ~ age + ltcf_type + (1|ltcf), family=binomial("logit"),data=data.mrsa)
fit2b <- glmer(mrsa_result ~ age + (1|ltcf + ltcf_type), family=binomial("logit"),data=data.mrsa)

Thanks.

$\endgroup$

1 Answer 1

4
$\begingroup$

fit2a <- glmer(mrsa_result ~ age + ltcf_type + (1|ltcf), family=binomial("logit"),data=data.mrsa)

The first line is correct. Each unit on L2 is represented in multiple data rows, and lme4 recognizes that ltcf_type is constant for each entry within a L2 unit. So it is treated automatically as a fixed effect on L2.

$\endgroup$

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.