diff --git a/exercises/_07-ex-model-slr.qmd b/exercises/_07-ex-model-slr.qmd index fdc4f25b..2b6de6b2 100644 --- a/exercises/_07-ex-model-slr.qmd +++ b/exercises/_07-ex-model-slr.qmd @@ -11,15 +11,15 @@ The scatterplots shown below each have a superimposed regression line. If we wer df <- tibble( x = seq(1, 100, 1), y_linear = 3 * x + 5 + rnorm(length(x), mean = 0, sd = 20), - y_fan_back = 4 * x + 5 + rnorm(length(x), mean = 0, sd = sort(1.3 * x, decreasing = TRUE)) - ) | + y_fan_back = 4 * x + 5 + rnorm(length(x), mean = 0, sd = sort(1.3 * x, decreasing = TRUE)) + ) |> pivot_longer(cols = -x, names_to = "type", values_to = "y") |> arrange(type) |> mutate(type_label = if_else(type == "y_linear", "(a)", "(b)")) ggplot(df, aes(x = x, y = y)) + geom_point(size = 2, alpha = 0.8) + - geom_smooth(method = "lm", se = FALSE, color = "black", size = 0.8) + + geom_smooth(method = "lm", se = FALSE, color = "black", linewidth = 0.8) + facet_wrap(~type_label) + theme(axis.text = element_blank()) + labs(x = NULL, y = NULL)