# Advice for mixed model with multilevel effects in R

Im migrating from SAS to R with a few difficulties, not to mention some large gaps in statistical knowledge.

Im investigating the effect of ethnicity on blood pressure, in a longitudinal study. For all ethnic groups, it is evident that their blood pressure declines the first 3-4 years and then it increases steadily thereafter (no other trend observed).

I have 100.000 observations, from 10.000 unique individuals. Data is heavily unbalanced; some individuals have 1 observation while others have 20. Observations are gathered at different time points.

Fixed covariates: age, sex, treatment, BMI, ethnicity. Random covariates: ethnicity Repeated measure unit: individual (ID).

How would You model this? I'm interested in the ethnic differences and must therefore have ethnicity as a fixed covariate. But ethnicity could be appreciated as a level in terms of multilevel models, and thus modeled as random in mixed models. Så my subjects are, if im not wrong, nested within ethnic groups.

I have read instruction manuals for both nlme package and lme4 package. I decided to go with lme4, despite non-linear trend in blood pressure but tried to adjust for this by taking the second polynomial of duration (time*time).

How would you model this? E.g:

lmer(hba1c_up ~ age + sex + (1|Ethnicityx/ID)) ?

lmer(hba1c_up ~ age + sex + (1|ID) + (1|Ethnicityx))


Any suggestions?

Help would be immensely appreciated!

• Ethnicity is a fixed effect, not a random effect. Feb 11, 2014 at 16:41
• But can it not be modeled as "random" (lmer handles levels and randoms the same way) due to it being a level? Would anyone recommend the (1|Ethnicity/ID) version? Ie individuals nestes within ethnic groups?
– user40049
Feb 11, 2014 at 18:56

• (+1) Actually, treating ethnicity as a random effect would let you see how each ethnicity deviates from the overall level (by looking at the level-2 residuals, e.g. by using the ranef() command in R), but as you point out, you get no significance test. Feb 11, 2014 at 22:26