ComenzarEmpieza gratis

Displaying chlamydia results

In the previous exercise, you fit a GLMER to the Illinois chlamydia data. During this exercise, we will go over some methods for displaying the results. You could use these methods to get summaries of the model for a client or document you are writing describing your results. However, I encourage you to learn how to manipulate and explore model outputs on your own to create your own methods for displaying results. Developing your own unique methods can help you stand out as a data scientist!

Here is what you will do:

  1. Examine the model estimates.
  2. Plot the data with and fit a glm to each age class. Although not exactly the same as the glmer() outputs, this approximation helps to display the results in a visually easy to understand method.

Este ejercicio forma parte del curso

Hierarchical and Mixed Effects Models in R

Ver curso

Instrucciones del ejercicio

  • Extract out the fixed-effect estimates from model_out using fixef().
  • Extract out the random-effect estimates from model_out using ranef().
  • Run the code to plot the data using ggplot2 methods.

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Extract out fixed effects
___
# Extract out random effects 
___

# Run code to see one method for plotting the data
ggplot(data = il_data_2, 
       aes(x = year, y = count, group = county)) +
    geom_line() +
    facet_grid(age ~ . ) +
    stat_smooth(method = "glm",
                method.args = list(family = "poisson"), 
                se = FALSE,
                alpha = 0.5) +
    theme_minimal()
Editar y ejecutar código