CommencerCommencer gratuitement

Hypothetical population - less variability in x direction

In order to understand the sampling distribution associated with the slope coefficient, it is valuable to visualize the impact changes in the sample and population have on the slope coefficient. Here, reducing the variance associated with the explanatory variable around the line changes the variability associated with the slope statistics.

Cet exercice fait partie du cours

Inference for Linear Regression in R

Afficher le cours

Instructions

  • Look at the plot that has been drawn for you.
  • Swap popdata for even_newer_popdata in the sampling code, and redraw the plot.
  • Set the x-axis limits from -17 to 17 (so they are the same as before).
  • Look at the new plot. How is it different?

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Update the sampling to use even_newer_popdata
many_samples <- popdata %>%
  rep_sample_n(size = 50, reps = 100)

# Update and rerun the plot; how does it change?
ggplot(many_samples, aes(x = explanatory, y = response, group = replicate)) + 
  geom_point() + 
  geom_smooth(method = "lm", se = FALSE) +
  # Set the x-axis limit from -17 to 17
  ___
Modifier et exécuter le code