2
$\begingroup$

I am working with a survey experiment. The data is set at three levels: individual, county, and state.

The experimental condition was randomized at the individual level 1. That is, some individuals in a county received the experimental condition while others did not.

How should I set the random intercept, multilevel model? I want the model to know that the experimental condition was set at the level 1.

I am working with this baseline model:

library(lme4)

model1 <- lmer(outcome ~ 1 + experimental.condition + (1|state) + 
                         (1|state:city), REML=FALSE, data = df)

Is this correct?

$\endgroup$

1 Answer 1

1
$\begingroup$

If your "city" random effect here is supposed to be "county", then your model would be correct. Otherwise, if you were trying to fit states, counties, and cities, it would instead be this:

library(lme4)

model1 <- lmer(outcome ~ 1 + experimental.condition + 
                (1|state/county/city), REML=FALSE, data = df)

This is also assuming that the individuals didn't have their own cluster due to repeated measurements, which I'm guessing isn't the case from what you described.

$\endgroup$
5
  • $\begingroup$ My bad, that's a typo. city and county are the same. Thank you. $\endgroup$ Commented Aug 27 at 1:54
  • $\begingroup$ as to your last sentence, that is correct as well. this was a one-shot experiment, no repeated measurements, $\endgroup$ Commented Aug 27 at 1:55
  • 2
    $\begingroup$ Your original model ought to be correct then. $\endgroup$ Commented Aug 27 at 1:56
  • $\begingroup$ Hi Shawn, thanks again. I was wondering if you could take a look at this follow-up question. Thanks stats.stackexchange.com/questions/653456/… $\endgroup$ Commented Aug 27 at 23:38
  • $\begingroup$ @YouLocalRUser I added an answer to your other question. I hope it helps! $\endgroup$
    – Erik Ruzek
    Commented Oct 11 at 19:52

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.