I am completely new to multilevel modeling. I am doing my first steps using the lme4 package. I have a three way nested data structure (i.e. cities, persons, individual tests). Both the cities and persons are coded as factor (e.g. cityA, cityB etc. and "1" represents person A). The following question arises: I would like to estimate a model where the individual tests are nested in persons which are themselves nested within different cities. I am aiming to estimate a model having nested random slops for persons and cities.

I am not sure about the order of the random effects. Is it "(1|cities/persons)" or "(1|persons/cities)".

Many thanks in advance! Kind regards

  • $\begingroup$ cities/persons means "persons nested within cities" or "city random effect plus city:person interaction": see glmm.wikidot.com/faq#modelspec ... if you are fitting a linear mixed model (i.e. using lmer) and if there is only one observation (row of the data set) per test, you do not want cities/persons/tests, because the test-level variation will be confounded with the residual variance which is automatically included in the model $\endgroup$ – Ben Bolker Mar 3 '14 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.