# Log 16.08 – Random / fixed slopes / effects / intercepts! And why? Plus R Formulas

• ger.: Mehrebenenanalye – Hierarchisch Lineare Modellierung
• engl.: multilevel modelling – random effects modelling – hierachical linear modelling – mixed modelling – random coefficient modelling

### What does random intercept mean? Is there a difference between random effect and random intercept model?

A random intercept model estimates separate intercepts for each unit of each level at which the intercept is permitted to vary. This is one kind of random effect model. Another kind of random effect model also includes random slopes, and estimates separate slopes (i.e. coefficients, betas, effects, etc. depending on your discipline) for each variable for each unit of each level at which that slope is permitted to vary. Random effect modelling uses random intercepts to accommodate for multi level structure within data. Random slopes are an extension allowing to describe differences between slopes and correlation between intercepts and slopes.

# Why Random Intercepts?

Why not simply include L2 variable in the model as a fixed factor/ control variable?

• fine if L2 has few categories
• not really interested in difference between counties
• if a lot of dummy categories -> eat up a lot of degrees of freedom

# Random Intercept + Fixed Slope/ Effects

#### what?

• the slopes for groups are assumed to be of the same value
• the structural part of the model is also called fixed effects

#### why?

• The researcher is interested in the characteristics of the sample, not the population
• weak effects??

# Random Intercept + Random Slope/ Effects

#### what?

• Effects are modelled allowing the slopes to vary between groups.

#### why?

• Enhance computation of fixed effects
• Not interested in L2 effects within sample, but in the effects in general population
• (might) fit the data better

#### report?

• variance in intercepts
• variance of  slopes
• covariance of slopes and intercepts

# Missing Data

• partially missing data not a big problem
• at least two points needed for calculating slope
• if only one data point only intercept is computed

# Formulas and Code in R

grand mean centering predictors (makes interactions easier to interpret)

### relevant packages and formula variations:

{nlme}

{lme4}

{ordinal}

{MCMCglmm}

Comparing model fits with ANOVA