LoslegenKostenlos loslegen

Hypothetical population - less variability around the line

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 response variable around the line changes the variability associated with the slope statistics.

Diese Übung ist Teil des Kurses

Inference for Linear Regression in R

Kurs anzeigen

Anleitung zur Übung

  • Look at the plot that has been drawn for you.
  • Swap popdata for new_popdata in the sampling code, and redraw the plot.
  • Look at the new plot. How is it different?

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

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

# 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) 
Code bearbeiten und ausführen