ComenzarEmpieza gratis

Slippery slopes: Random Intercept and Random Slope Model

Now we can move on to fit the random intercept and random slope model to the rat growth data. Fitting a random intercept and random slope model allows the linear regression fits for each individual to differ in intercept but also in slope. This way it is possible to account for the individual differences in the rats' growth profiles, but also the effect of time.

Este ejercicio forma parte del curso

Helsinki Open Data Science

Ver curso

Instrucciones del ejercicio

  • Fit the random intercept and slope model with Time and ID as the random effects
  • Print the summary of the model
  • Compute the analysis of variance tables of the models RATS_ref and RATS_ref1
  • Pay attention to the chi-squared statistics and p-value of the likelihood ratio test between RATS_ref1 and RATS_ref. The lower the value the better the fit against the comparison model.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# dplyr, tidyr, lme4, ggplot2, RATS and RATSL are available

# create a random intercept and random slope model
RATS_ref1 <- lmer(Weight ~ Time + Group + (Time | ID), data = RATSL, REML = FALSE)

# print a summary of the model


# perform an ANOVA test on the two models
anova(RATS_ref1, RATS_ref)
Editar y ejecutar código