ComenzarEmpieza gratis

Post-modeling validation plots + variance

In the last exercise, we found that int_rate does differ by grade. Now we should validate this model, which for linear regression means examining the Residuals vs. Fitted and Normal Q-Q plots.

If you call plot() on a model object in R, it will automatically plot both of those plots plus two more. You'll interpret these plots to evaluate model fit. We discussed how to do this in the video.

Another assumption of ANOVA and linear modeling is homogeneity of variance. Homogeneity means "same", and here that would mean that the variance of int_rate is the same for each level of grade. We can test for homogeneity of variances using bartlett.test(), which takes a formula and a dataset as inputs.

Este ejercicio forma parte del curso

Experimental Design in R

Ver curso

Instrucciones del ejercicio

  • Run the first line of code with par() so the plots will output in a 2 by 2 grid.
  • Call plot() on grade_aov (which has been created for you) to produce the model diagnostic plots.
  • Test for homogeneity of variances using bartlett.test().

Ejercicio interactivo práctico

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

# For a 2x2 grid of plots:
par(mfrow=c(___, ___))

# Plot grade_aov
___

# Bartlett's test for homogeneity of variance
___
Editar y ejecutar código