diff --git a/.nojekyll b/.nojekyll index 3f4518c..18c06fd 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -8d7184dc \ No newline at end of file +0fb35371 \ No newline at end of file diff --git a/schedule/slides/02-lm-example.html b/schedule/slides/02-lm-example.html index 4f1fcf3..a0c380e 100644 --- a/schedule/slides/02-lm-example.html +++ b/schedule/slides/02-lm-example.html @@ -398,7 +398,7 @@

02 Linear model example

Stat 406

Geoff Pleiss, Trevor Campbell

-

Last modified – 10 December 2023

+

Last modified – 13 September 2024

\[ \DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator*{\argmax}{argmax} @@ -491,9 +491,9 @@

Analysis

set.seed(20220914)
-mob <- mobility[complete.cases(mobility), ]
-n <- nrow(mob)
-mob <- mob |> select(-Name, -ID, -State)
+mob <- mobility[complete.cases(mobility), ] |>
+    select(-Name, -ID, -State)
+n <- nrow(mob)
 set <- sample.int(n, floor(n * .75), FALSE)
 train <- mob[set, ]
 test <- mob[setdiff(1:n, set), ]
@@ -516,6 +516,7 @@ 

Analysis

Results

+

(dispatch happening here!)

summary(full)
@@ -582,8 +583,19 @@

Results

Diagnostic plots

-
par(mar = c(5, 3, 0, 0))
-plot(full, 1)
+
stuff <- tibble(
+  residuals = residuals(full),
+  fitted = fitted(full),
+  stdresiduals = rstandard(full)
+)
+ggplot(stuff, aes(fitted, residuals)) +
+  geom_point() +
+  geom_smooth(
+    se = FALSE,
+    colour = "steelblue",
+    linewidth = 2
+  ) +
+  ggtitle("Residuals vs Fitted")
@@ -595,7 +607,14 @@

Diagnostic plots

-
plot(full, 2)
+
ggplot(stuff, aes(sample = stdresiduals)) +
+  geom_qq(size = 2) +
+  geom_qq_line(linewidth = 2, color = "steelblue") +
+  labs(
+    x = "Theoretical quantiles",
+    y = "Standardized residuals",
+    title = "Normal Q-Q"
+  )
@@ -606,25 +625,11 @@

Diagnostic plots

-
-

-

(Those were plot methods for objects of class lm)

-

Same thing in ggplot

+
+

Can also just use dispatched plot

-
stuff <- tibble(
-  residuals = residuals(full),
-  fitted = fitted(full),
-  stdresiduals = rstandard(full)
-)
-ggplot(stuff, aes(fitted, residuals)) +
-  geom_point(colour = "salmon") +
-  geom_smooth(
-    se = FALSE,
-    colour = "steelblue",
-    linewidth = 2
-  ) +
-  ggtitle("Residuals vs Fitted")
+
plot(full, 1)
@@ -636,14 +641,7 @@

-
ggplot(stuff, aes(sample = stdresiduals)) +
-  geom_qq(colour = "purple", size = 2) +
-  geom_qq_line(colour = "peachpuff", linewidth = 2) +
-  labs(
-    x = "Theoretical quantiles",
-    y = "Standardized residuals",
-    title = "Normal Q-Q"
-  )
+
plot(full, 2)
@@ -663,20 +661,18 @@

Fit a reduced model

data = train ) -summary(reduced)$coefficients |> as_tibble()
+summary(reduced)$coefficients
-
# A tibble: 9 × 4
-   Estimate `Std. Error` `t value` `Pr(>|t|)`
-      <dbl>        <dbl>     <dbl>      <dbl>
-1  0.166        0.0178        9.36   1.83e-18
-2  0.0637       0.0149        4.27   2.62e- 5
-3 -0.109        0.0390       -2.79   5.64e- 3
-4  0.000500     0.000256      1.95   5.19e- 2
-5 -0.216        0.0820       -2.64   8.81e- 3
-6 -0.159        0.0202       -7.89   5.65e-14
-7 -0.389        0.172        -2.26   2.42e- 2
-8  0.0436       0.0105        4.16   4.08e- 5
-9 -0.286        0.0466       -6.15   2.44e- 9
+
                    Estimate  Std. Error   t value     Pr(>|t|)
+(Intercept)     0.1663344179 0.017769995  9.360409 1.829270e-18
+Commute         0.0637329409 0.014926382  4.269819 2.618234e-05
+Gini_99        -0.1086058241 0.038958986 -2.787696 5.642726e-03
+Test_scores     0.0004997645 0.000256038  1.951915 5.186618e-02
+HS_dropout     -0.2162067301 0.082003195 -2.636565 8.805228e-03
+Manufacturing  -0.1594229237 0.020215791 -7.886059 5.647668e-14
+Migration_in   -0.3891567027 0.171839168 -2.264657 2.423771e-02
+Religious       0.0435673365 0.010463920  4.163577 4.084854e-05
+Single_mothers -0.2864269552 0.046578928 -6.149282 2.444903e-09
reduced |>
   broom::glance() |>
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-10-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-10-1.svg
index 598a4d2..c565f0e 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-10-1.svg
+++ b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-10-1.svg
@@ -1,729 +1,733 @@
 
-
+
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
 
 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
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
 
-
-
-
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-12-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-12-1.svg
deleted file mode 100644
index d3ba892..0000000
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-12-1.svg
+++ /dev/null
@@ -1,716 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-13-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-13-1.svg
index d3ba892..385a248 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-13-1.svg
+++ b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-13-1.svg
@@ -1,716 +1,720 @@
 
-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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+
+
+
+
+
+  
+  
+  
+  
+
+
+
+
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-4-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-4-1.svg
index 671b2de..58ff0ed 100644
--- a/schedule/slides/02-lm-example_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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
 
-
-
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-4-2.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-4-2.svg
deleted file mode 100644
index 5fbcde6..0000000
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-4-2.svg
+++ /dev/null
@@ -1,559 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-5-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-5-1.svg
index cb49a35..c381a86 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-5-1.svg
+++ b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-5-1.svg
@@ -1,642 +1,723 @@
 
-
+
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+
+  
+  
+
+
+  
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-6-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-6-1.svg
index ed8b113..cd9c2b9 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-6-1.svg
+++ b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-6-1.svg
@@ -1,629 +1,601 @@
 
-
+
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+
+
+  
+  
+
+
+  
+  
+  
+
+
+
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-7-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-7-1.svg
index 0338bf6..7a79d6a 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-7-1.svg
+++ b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-7-1.svg
@@ -1,718 +1,646 @@
 
-
+
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
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+  
+
+
+  
+
+
+  
+
+
+  
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+
+
+  
+  
+
+
+  
+  
+  
 
-
-
-
-
-
-
-
-
-
-
-
 
 
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-8-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-8-1.svg
deleted file mode 100644
index 12a6192..0000000
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-8-1.svg
+++ /dev/null
@@ -1,691 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-9-1.svg b/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-9-1.svg
index 20858dc..0464ddd 100644
--- a/schedule/slides/02-lm-example_files/figure-revealjs/unnamed-chunk-9-1.svg
+++ b/schedule/slides/02-lm-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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+
+
+
 
-
-
 
 
diff --git a/schedule/slides/03-regression-function.html b/schedule/slides/03-regression-function.html
index 4f65b37..e66513e 100644
--- a/schedule/slides/03-regression-function.html
+++ b/schedule/slides/03-regression-function.html
@@ -398,7 +398,7 @@
 

03 The regression function

Stat 406

Geoff Pleiss, Trevor Campbell

-

Last modified – 18 September 2023

+

Last modified – 14 September 2024

\[ \DeclareMathOperator*{\argmin}{argmin} \DeclareMathOperator*{\argmax}{argmax} @@ -418,6 +418,15 @@

03 The regression function

\newcommand{\R}{\mathbb{R}} \newcommand{\norm}[1]{\left\lVert #1 \right\rVert} \newcommand{\snorm}[1]{\lVert #1 \rVert} +\newcommand{\tr}[1]{\mbox{tr}(#1)} +\newcommand{\brt}{\widehat{\beta}^R_{s}} +\newcommand{\brl}{\widehat{\beta}^R_{\lambda}} +\newcommand{\bls}{\widehat{\beta}_{ols}} +\newcommand{\blt}{\widehat{\beta}^L_{s}} +\newcommand{\bll}{\widehat{\beta}^L_{\lambda}} +\newcommand{\U}{\mathbf{U}} +\newcommand{\D}{\mathbf{D}} +\newcommand{\V}{\mathbf{V}} \]

@@ -462,10 +471,10 @@

Statistical models 101

Some examples:

    -
  1. \(\P = \{ 0 < p < 1 : P(z=1)=p,\ P(z=0)=1-p\}\).
  2. -
  3. \(\P = \{ \beta \in \R^p,\ \sigma>0 : Y \sim N(X^\top\beta,\sigma^2),\ X\mbox{ fixed}\}\).
  4. -
  5. \(\P = \{\mbox{all CDF's }F\}\).
  6. -
  7. \(\P = \{\mbox{all smooth functions } f: \R^p \rightarrow \R : Z_i = (X_i, Y_i),\ E[Y_i] = f(X_i) \}\)
  8. +
  9. \(\P = \{P : P(Z=1)=p,\ P(Z=0)=1-p, 0 \leq p \leq 1\}\).
  10. +
  11. \(\P = \{P : Y | X \sim N(X^\top\beta,\sigma^2),\ \beta \in \R^p,\ \sigma>0\}\) (here \(Z = (Y,X)\))
  12. +
  13. \(\P = \{P \mbox{ given by any CDF }F\}\).
  14. +
  15. \(\P = \{P : E[Y | X] = f(X) \mbox{ for some smooth } f: \R^p \rightarrow \R\}\) (here \(Z = (Y,X)\))
@@ -474,7 +483,7 @@

Statistical models

My model:

\[ -\P = \{ P(z=1)=p,\ P(z=0)=1-p,\ 0 < p < 1 \} +\P = \{P: P(z=1)=p,\ P(z=0)=1-p,\ 0 < p < 1 \} \]

  • To completely characterize \(P\), I just need to estimate \(p\).

  • @@ -485,33 +494,36 @@

    My model:

Statistical models

-

We observe data \(Z_i=(Y_i,X_i)\) generated by some probability distribution \(P\). We want to use the data to learn about \(P\).

+

We observe data \((Y, X)\) generated by some probability distribution \(P\) on \(\R \times \R^p\). We want to use the data to learn about \(P\).

My model

\[ -\P = \{ \beta \in \R^p, \sigma>0 : Y_i \given X_i=x_i \sim N(x_i^\top\beta,\ \sigma^2) \}. +\P = \{P : Y | X \sim N(X^\top\beta,\ \sigma^2), \beta \in \R^p, \sigma>0\}. \]

    -
  • To completely characterize \(P\), I just need to estimate \(\beta\) and \(\sigma\).

  • +
  • To completely characterize the \(Y|X\)-conditional of \(P\), I just need to estimate \(\beta\) and \(\sigma\).

    +
      +
    • I’m not interested in learning the \(X\)-marginal of \(P\)
    • +
  • Need to assume that \(P\in\P\).

  • -
  • This time, I have to assume a lot more: (conditional) Linearity, independence, conditional Gaussian noise, no ignored variables, no collinearity, etc.

  • +
  • This time, I have to assume a lot more: (conditional) linearity, independence, conditional Gaussian noise, no ignored variables, no collinearity, etc.

Statistical models, unfamiliar example

-

We observe data \(Z_i \in \R\) generated by some probability distribution \(P\). We want to use the data to learn about \(P\).

+

We observe data \(Z \in \R\) generated by some probability distribution \(P\). We want to use the data to learn about \(P\).

My model

\[ -\P = \{ Z_i \textrm{ has a density function } f \}. +\P = \{P : Z \textrm{ has a density function } f \}. \]

  • To completely characterize \(P\), I need to estimate \(f\).

  • In fact, we can’t hope to do this.

-

Revised Model 1 - \(\P=\{ Z_i \textrm{ has a density function } f : \int (f'')^2 dx < M \}\)

-

Revised Model 2 - \(\P=\{ Z_i \textrm{ has a density function } f : \int (f'')^2 dx < K < M \}\)

-

Revised Model 3 - \(\P=\{ Z_i \textrm{ has a density function } f : \int |f'| dx < M \}\)

+

Revised Model 1 - \(\P=\{ Z \textrm{ has a density function } f : \int (f'')^2 dx < M \}\)

+

Revised Model 2 - \(\P=\{ Z \textrm{ has a density function } f : \int (f'')^2 dx < K < M \}\)

+

Revised Model 3 - \(\P=\{ Z \textrm{ has a density function } f : \int |f'| dx < M \}\)

  • Each of these suggests different ways of estimating \(f\)
diff --git a/schedule/slides/03-regression-function_files/figure-revealjs/unnamed-chunk-1-1.svg b/schedule/slides/03-regression-function_files/figure-revealjs/unnamed-chunk-1-1.svg index e3e4249..de46afd 100644 --- a/schedule/slides/03-regression-function_files/figure-revealjs/unnamed-chunk-1-1.svg +++ b/schedule/slides/03-regression-function_files/figure-revealjs/unnamed-chunk-1-1.svg @@ -1,276 +1,269 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + - - - - - - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - diff --git a/search.json b/search.json index 73118ad..e230521 100644 --- a/search.json +++ b/search.json @@ -3028,7 +3028,7 @@ "href": "schedule/slides/03-regression-function.html#section", "title": "UBC Stat406 2024W", "section": "03 The regression function", - "text": "03 The regression function\nStat 406\nGeoff Pleiss, Trevor Campbell\nLast modified – 18 September 2023\n\\[\n\\DeclareMathOperator*{\\argmin}{argmin}\n\\DeclareMathOperator*{\\argmax}{argmax}\n\\DeclareMathOperator*{\\minimize}{minimize}\n\\DeclareMathOperator*{\\maximize}{maximize}\n\\DeclareMathOperator*{\\find}{find}\n\\DeclareMathOperator{\\st}{subject\\,\\,to}\n\\newcommand{\\E}{E}\n\\newcommand{\\Expect}[1]{\\E\\left[ #1 \\right]}\n\\newcommand{\\Var}[1]{\\mathrm{Var}\\left[ #1 \\right]}\n\\newcommand{\\Cov}[2]{\\mathrm{Cov}\\left[#1,\\ #2\\right]}\n\\newcommand{\\given}{\\ \\vert\\ }\n\\newcommand{\\X}{\\mathbf{X}}\n\\newcommand{\\x}{\\mathbf{x}}\n\\newcommand{\\y}{\\mathbf{y}}\n\\newcommand{\\P}{\\mathcal{P}}\n\\newcommand{\\R}{\\mathbb{R}}\n\\newcommand{\\norm}[1]{\\left\\lVert #1 \\right\\rVert}\n\\newcommand{\\snorm}[1]{\\lVert #1 \\rVert}\n\\]" + "text": "03 The regression function\nStat 406\nGeoff Pleiss, Trevor Campbell\nLast modified – 14 September 2024\n\\[\n\\DeclareMathOperator*{\\argmin}{argmin}\n\\DeclareMathOperator*{\\argmax}{argmax}\n\\DeclareMathOperator*{\\minimize}{minimize}\n\\DeclareMathOperator*{\\maximize}{maximize}\n\\DeclareMathOperator*{\\find}{find}\n\\DeclareMathOperator{\\st}{subject\\,\\,to}\n\\newcommand{\\E}{E}\n\\newcommand{\\Expect}[1]{\\E\\left[ #1 \\right]}\n\\newcommand{\\Var}[1]{\\mathrm{Var}\\left[ #1 \\right]}\n\\newcommand{\\Cov}[2]{\\mathrm{Cov}\\left[#1,\\ #2\\right]}\n\\newcommand{\\given}{\\ \\vert\\ }\n\\newcommand{\\X}{\\mathbf{X}}\n\\newcommand{\\x}{\\mathbf{x}}\n\\newcommand{\\y}{\\mathbf{y}}\n\\newcommand{\\P}{\\mathcal{P}}\n\\newcommand{\\R}{\\mathbb{R}}\n\\newcommand{\\norm}[1]{\\left\\lVert #1 \\right\\rVert}\n\\newcommand{\\snorm}[1]{\\lVert #1 \\rVert}\n\\newcommand{\\tr}[1]{\\mbox{tr}(#1)}\n\\newcommand{\\brt}{\\widehat{\\beta}^R_{s}}\n\\newcommand{\\brl}{\\widehat{\\beta}^R_{\\lambda}}\n\\newcommand{\\bls}{\\widehat{\\beta}_{ols}}\n\\newcommand{\\blt}{\\widehat{\\beta}^L_{s}}\n\\newcommand{\\bll}{\\widehat{\\beta}^L_{\\lambda}}\n\\newcommand{\\U}{\\mathbf{U}}\n\\newcommand{\\D}{\\mathbf{D}}\n\\newcommand{\\V}{\\mathbf{V}}\n\\]" }, { "objectID": "schedule/slides/03-regression-function.html#mean-squared-error-mse", @@ -3056,28 +3056,28 @@ "href": "schedule/slides/03-regression-function.html#statistical-models-101", "title": "UBC Stat406 2024W", "section": "Statistical models 101", - "text": "Statistical models 101\nWe observe data \\(Z_1,\\ Z_2,\\ \\ldots,\\ Z_n\\) generated by some probability distribution \\(P\\). We want to use the data to learn about \\(P\\).\n\nA statistical model is a set of distributions \\(\\mathcal{P}\\).\n\nSome examples:\n\n\\(\\P = \\{ 0 < p < 1 : P(z=1)=p,\\ P(z=0)=1-p\\}\\).\n\\(\\P = \\{ \\beta \\in \\R^p,\\ \\sigma>0 : Y \\sim N(X^\\top\\beta,\\sigma^2),\\ X\\mbox{ fixed}\\}\\).\n\\(\\P = \\{\\mbox{all CDF's }F\\}\\).\n\\(\\P = \\{\\mbox{all smooth functions } f: \\R^p \\rightarrow \\R : Z_i = (X_i, Y_i),\\ E[Y_i] = f(X_i) \\}\\)" + "text": "Statistical models 101\nWe observe data \\(Z_1,\\ Z_2,\\ \\ldots,\\ Z_n\\) generated by some probability distribution \\(P\\). We want to use the data to learn about \\(P\\).\n\nA statistical model is a set of distributions \\(\\mathcal{P}\\).\n\nSome examples:\n\n\\(\\P = \\{P : P(Z=1)=p,\\ P(Z=0)=1-p, 0 \\leq p \\leq 1\\}\\).\n\\(\\P = \\{P : Y | X \\sim N(X^\\top\\beta,\\sigma^2),\\ \\beta \\in \\R^p,\\ \\sigma>0\\}\\) (here \\(Z = (Y,X)\\))\n\\(\\P = \\{P \\mbox{ given by any CDF }F\\}\\).\n\\(\\P = \\{P : E[Y | X] = f(X) \\mbox{ for some smooth } f: \\R^p \\rightarrow \\R\\}\\) (here \\(Z = (Y,X)\\))" }, { "objectID": "schedule/slides/03-regression-function.html#statistical-models", "href": "schedule/slides/03-regression-function.html#statistical-models", "title": "UBC Stat406 2024W", "section": "Statistical models", - "text": "Statistical models\nWe want to use the data to select a distribution \\(P\\) that probably generated the data.\n\nMy model:\n\\[\n\\P = \\{ P(z=1)=p,\\ P(z=0)=1-p,\\ 0 < p < 1 \\}\n\\]\n\nTo completely characterize \\(P\\), I just need to estimate \\(p\\).\nNeed to assume that \\(P \\in \\P\\).\nThis assumption is mostly empty: need independent, can’t see \\(z=12\\)." + "text": "Statistical models\nWe want to use the data to select a distribution \\(P\\) that probably generated the data.\n\nMy model:\n\\[\n\\P = \\{P: P(z=1)=p,\\ P(z=0)=1-p,\\ 0 < p < 1 \\}\n\\]\n\nTo completely characterize \\(P\\), I just need to estimate \\(p\\).\nNeed to assume that \\(P \\in \\P\\).\nThis assumption is mostly empty: need independent, can’t see \\(z=12\\)." }, { "objectID": "schedule/slides/03-regression-function.html#statistical-models-1", "href": "schedule/slides/03-regression-function.html#statistical-models-1", "title": "UBC Stat406 2024W", "section": "Statistical models", - "text": "Statistical models\nWe observe data \\(Z_i=(Y_i,X_i)\\) generated by some probability distribution \\(P\\). We want to use the data to learn about \\(P\\).\n\nMy model\n\\[\n\\P = \\{ \\beta \\in \\R^p, \\sigma>0 : Y_i \\given X_i=x_i \\sim N(x_i^\\top\\beta,\\ \\sigma^2) \\}.\n\\]\n\nTo completely characterize \\(P\\), I just need to estimate \\(\\beta\\) and \\(\\sigma\\).\nNeed to assume that \\(P\\in\\P\\).\nThis time, I have to assume a lot more: (conditional) Linearity, independence, conditional Gaussian noise, no ignored variables, no collinearity, etc." + "text": "Statistical models\nWe observe data \\((Y, X)\\) generated by some probability distribution \\(P\\) on \\(\\R \\times \\R^p\\). We want to use the data to learn about \\(P\\).\n\nMy model\n\\[\n\\P = \\{P : Y | X \\sim N(X^\\top\\beta,\\ \\sigma^2), \\beta \\in \\R^p, \\sigma>0\\}.\n\\]\n\nTo completely characterize the \\(Y|X\\)-conditional of \\(P\\), I just need to estimate \\(\\beta\\) and \\(\\sigma\\).\n\nI’m not interested in learning the \\(X\\)-marginal of \\(P\\)\n\nNeed to assume that \\(P\\in\\P\\).\nThis time, I have to assume a lot more: (conditional) linearity, independence, conditional Gaussian noise, no ignored variables, no collinearity, etc." }, { "objectID": "schedule/slides/03-regression-function.html#statistical-models-unfamiliar-example", "href": "schedule/slides/03-regression-function.html#statistical-models-unfamiliar-example", "title": "UBC Stat406 2024W", "section": "Statistical models, unfamiliar example", - "text": "Statistical models, unfamiliar example\nWe observe data \\(Z_i \\in \\R\\) generated by some probability distribution \\(P\\). We want to use the data to learn about \\(P\\).\nMy model\n\\[\n\\P = \\{ Z_i \\textrm{ has a density function } f \\}.\n\\]\n\nTo completely characterize \\(P\\), I need to estimate \\(f\\).\nIn fact, we can’t hope to do this.\n\nRevised Model 1 - \\(\\P=\\{ Z_i \\textrm{ has a density function } f : \\int (f'')^2 dx < M \\}\\)\nRevised Model 2 - \\(\\P=\\{ Z_i \\textrm{ has a density function } f : \\int (f'')^2 dx < K < M \\}\\)\nRevised Model 3 - \\(\\P=\\{ Z_i \\textrm{ has a density function } f : \\int |f'| dx < M \\}\\)\n\nEach of these suggests different ways of estimating \\(f\\)" + "text": "Statistical models, unfamiliar example\nWe observe data \\(Z \\in \\R\\) generated by some probability distribution \\(P\\). We want to use the data to learn about \\(P\\).\nMy model\n\\[\n\\P = \\{P : Z \\textrm{ has a density function } f \\}.\n\\]\n\nTo completely characterize \\(P\\), I need to estimate \\(f\\).\nIn fact, we can’t hope to do this.\n\nRevised Model 1 - \\(\\P=\\{ Z \\textrm{ has a density function } f : \\int (f'')^2 dx < M \\}\\)\nRevised Model 2 - \\(\\P=\\{ Z \\textrm{ has a density function } f : \\int (f'')^2 dx < K < M \\}\\)\nRevised Model 3 - \\(\\P=\\{ Z \\textrm{ has a density function } f : \\int |f'| dx < M \\}\\)\n\nEach of these suggests different ways of estimating \\(f\\)" }, { "objectID": "schedule/slides/03-regression-function.html#assumption-lean-regression", @@ -4239,7 +4239,7 @@ "href": "schedule/slides/02-lm-example.html#section", "title": "UBC Stat406 2024W", "section": "02 Linear model example", - "text": "02 Linear model example\nStat 406\nGeoff Pleiss, Trevor Campbell\nLast modified – 10 December 2023\n\\[\n\\DeclareMathOperator*{\\argmin}{argmin}\n\\DeclareMathOperator*{\\argmax}{argmax}\n\\DeclareMathOperator*{\\minimize}{minimize}\n\\DeclareMathOperator*{\\maximize}{maximize}\n\\DeclareMathOperator*{\\find}{find}\n\\DeclareMathOperator{\\st}{subject\\,\\,to}\n\\newcommand{\\E}{E}\n\\newcommand{\\Expect}[1]{\\E\\left[ #1 \\right]}\n\\newcommand{\\Var}[1]{\\mathrm{Var}\\left[ #1 \\right]}\n\\newcommand{\\Cov}[2]{\\mathrm{Cov}\\left[#1,\\ #2\\right]}\n\\newcommand{\\given}{\\ \\vert\\ }\n\\newcommand{\\X}{\\mathbf{X}}\n\\newcommand{\\x}{\\mathbf{x}}\n\\newcommand{\\y}{\\mathbf{y}}\n\\newcommand{\\P}{\\mathcal{P}}\n\\newcommand{\\R}{\\mathbb{R}}\n\\newcommand{\\norm}[1]{\\left\\lVert #1 \\right\\rVert}\n\\newcommand{\\snorm}[1]{\\lVert #1 \\rVert}\n\\newcommand{\\tr}[1]{\\mbox{tr}(#1)}\n\\newcommand{\\brt}{\\widehat{\\beta}^R_{s}}\n\\newcommand{\\brl}{\\widehat{\\beta}^R_{\\lambda}}\n\\newcommand{\\bls}{\\widehat{\\beta}_{ols}}\n\\newcommand{\\blt}{\\widehat{\\beta}^L_{s}}\n\\newcommand{\\bll}{\\widehat{\\beta}^L_{\\lambda}}\n\\newcommand{\\U}{\\mathbf{U}}\n\\newcommand{\\D}{\\mathbf{D}}\n\\newcommand{\\V}{\\mathbf{V}}\n\\]" + "text": "02 Linear model example\nStat 406\nGeoff Pleiss, Trevor Campbell\nLast modified – 13 September 2024\n\\[\n\\DeclareMathOperator*{\\argmin}{argmin}\n\\DeclareMathOperator*{\\argmax}{argmax}\n\\DeclareMathOperator*{\\minimize}{minimize}\n\\DeclareMathOperator*{\\maximize}{maximize}\n\\DeclareMathOperator*{\\find}{find}\n\\DeclareMathOperator{\\st}{subject\\,\\,to}\n\\newcommand{\\E}{E}\n\\newcommand{\\Expect}[1]{\\E\\left[ #1 \\right]}\n\\newcommand{\\Var}[1]{\\mathrm{Var}\\left[ #1 \\right]}\n\\newcommand{\\Cov}[2]{\\mathrm{Cov}\\left[#1,\\ #2\\right]}\n\\newcommand{\\given}{\\ \\vert\\ }\n\\newcommand{\\X}{\\mathbf{X}}\n\\newcommand{\\x}{\\mathbf{x}}\n\\newcommand{\\y}{\\mathbf{y}}\n\\newcommand{\\P}{\\mathcal{P}}\n\\newcommand{\\R}{\\mathbb{R}}\n\\newcommand{\\norm}[1]{\\left\\lVert #1 \\right\\rVert}\n\\newcommand{\\snorm}[1]{\\lVert #1 \\rVert}\n\\newcommand{\\tr}[1]{\\mbox{tr}(#1)}\n\\newcommand{\\brt}{\\widehat{\\beta}^R_{s}}\n\\newcommand{\\brl}{\\widehat{\\beta}^R_{\\lambda}}\n\\newcommand{\\bls}{\\widehat{\\beta}_{ols}}\n\\newcommand{\\blt}{\\widehat{\\beta}^L_{s}}\n\\newcommand{\\bll}{\\widehat{\\beta}^L_{\\lambda}}\n\\newcommand{\\U}{\\mathbf{U}}\n\\newcommand{\\D}{\\mathbf{D}}\n\\newcommand{\\V}{\\mathbf{V}}\n\\]" }, { "objectID": "schedule/slides/02-lm-example.html#economic-mobility", @@ -4260,35 +4260,35 @@ "href": "schedule/slides/02-lm-example.html#analysis", "title": "UBC Stat406 2024W", "section": "Analysis", - "text": "Analysis\n\nRandomly split into a training (say 3/4) and a test set (1/4)\nUse training set to fit a model\nFit the “full” model\n“Look” at the fit\n\n\n\nset.seed(20220914)\nmob <- mobility[complete.cases(mobility), ]\nn <- nrow(mob)\nmob <- mob |> select(-Name, -ID, -State)\nset <- sample.int(n, floor(n * .75), FALSE)\ntrain <- mob[set, ]\ntest <- mob[setdiff(1:n, set), ]\nfull <- lm(Mobility ~ ., data = train)\n\n\nWhy don’t we include Name or ID?" + "text": "Analysis\n\nRandomly split into a training (say 3/4) and a test set (1/4)\nUse training set to fit a model\nFit the “full” model\n“Look” at the fit\n\n\n\nset.seed(20220914)\nmob <- mobility[complete.cases(mobility), ] |>\n select(-Name, -ID, -State)\nn <- nrow(mob)\nset <- sample.int(n, floor(n * .75), FALSE)\ntrain <- mob[set, ]\ntest <- mob[setdiff(1:n, set), ]\nfull <- lm(Mobility ~ ., data = train)\n\n\nWhy don’t we include Name or ID?" }, { "objectID": "schedule/slides/02-lm-example.html#results", "href": "schedule/slides/02-lm-example.html#results", "title": "UBC Stat406 2024W", "section": "Results", - "text": "Results\n\nsummary(full)\n\n\nCall:\nlm(formula = Mobility ~ ., data = train)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.072092 -0.010256 -0.001452 0.009170 0.090428 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 1.849e-01 8.083e-02 2.288 0.022920 * \nPopulation 3.378e-09 2.478e-09 1.363 0.173916 \nUrban 2.853e-03 3.892e-03 0.733 0.464202 \nBlack 7.807e-02 2.859e-02 2.731 0.006735 ** \nSeg_racial -5.626e-02 1.780e-02 -3.160 0.001754 ** \nSeg_income 8.677e-01 9.355e-01 0.928 0.354453 \nSeg_poverty -7.416e-01 5.014e-01 -1.479 0.140316 \nSeg_affluence -2.224e-01 4.763e-01 -0.467 0.640874 \nCommute 6.313e-02 2.838e-02 2.225 0.026915 * \nIncome 4.207e-07 6.997e-07 0.601 0.548112 \nGini 3.592e+00 3.357e+00 1.070 0.285578 \nShare01 -3.635e-02 3.357e-02 -1.083 0.279925 \nGini_99 -3.657e+00 3.356e+00 -1.090 0.276704 \nMiddle_class 1.031e-01 4.835e-02 2.133 0.033828 * \nLocal_tax_rate 2.268e-01 2.620e-01 0.866 0.387487 \nLocal_gov_spending 1.273e-07 3.016e-06 0.042 0.966374 \nProgressivity 4.983e-03 1.324e-03 3.764 0.000205 ***\nEITC -3.324e-04 4.528e-04 -0.734 0.463549 \nSchool_spending -9.019e-04 2.272e-03 -0.397 0.691658 \nStudent_teacher_ratio -1.639e-03 1.123e-03 -1.459 0.145748 \nTest_scores 2.487e-04 3.137e-04 0.793 0.428519 \nHS_dropout -1.698e-01 9.352e-02 -1.816 0.070529 . \nColleges -2.811e-02 7.661e-02 -0.367 0.713942 \nTuition 3.459e-07 4.362e-07 0.793 0.428417 \nGraduation -1.702e-02 1.425e-02 -1.194 0.233650 \nLabor_force_participation -7.850e-02 5.405e-02 -1.452 0.147564 \nManufacturing -1.605e-01 2.816e-02 -5.700 3.1e-08 ***\nChinese_imports -5.165e-04 1.004e-03 -0.514 0.607378 \nTeenage_labor -1.019e+00 2.111e+00 -0.483 0.629639 \nMigration_in 4.490e-02 3.480e-01 0.129 0.897436 \nMigration_out -4.475e-01 4.093e-01 -1.093 0.275224 \nForeign_born 9.137e-02 5.494e-02 1.663 0.097454 . \nSocial_capital -1.114e-03 2.728e-03 -0.408 0.683245 \nReligious 4.570e-02 1.298e-02 3.520 0.000506 ***\nViolent_crime -3.393e+00 1.622e+00 -2.092 0.037373 * \nSingle_mothers -3.590e-01 9.442e-02 -3.802 0.000177 ***\nDivorced 1.707e-02 1.603e-01 0.107 0.915250 \nMarried -5.894e-02 7.246e-02 -0.813 0.416720 \nLongitude -4.239e-05 2.239e-04 -0.189 0.850001 \nLatitude 6.725e-04 5.687e-04 1.182 0.238037 \n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.02128 on 273 degrees of freedom\nMultiple R-squared: 0.7808, Adjusted R-squared: 0.7494 \nF-statistic: 24.93 on 39 and 273 DF, p-value: < 2.2e-16" + "text": "Results\n(dispatch happening here!)\n\nsummary(full)\n\n\nCall:\nlm(formula = Mobility ~ ., data = train)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.072092 -0.010256 -0.001452 0.009170 0.090428 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 1.849e-01 8.083e-02 2.288 0.022920 * \nPopulation 3.378e-09 2.478e-09 1.363 0.173916 \nUrban 2.853e-03 3.892e-03 0.733 0.464202 \nBlack 7.807e-02 2.859e-02 2.731 0.006735 ** \nSeg_racial -5.626e-02 1.780e-02 -3.160 0.001754 ** \nSeg_income 8.677e-01 9.355e-01 0.928 0.354453 \nSeg_poverty -7.416e-01 5.014e-01 -1.479 0.140316 \nSeg_affluence -2.224e-01 4.763e-01 -0.467 0.640874 \nCommute 6.313e-02 2.838e-02 2.225 0.026915 * \nIncome 4.207e-07 6.997e-07 0.601 0.548112 \nGini 3.592e+00 3.357e+00 1.070 0.285578 \nShare01 -3.635e-02 3.357e-02 -1.083 0.279925 \nGini_99 -3.657e+00 3.356e+00 -1.090 0.276704 \nMiddle_class 1.031e-01 4.835e-02 2.133 0.033828 * \nLocal_tax_rate 2.268e-01 2.620e-01 0.866 0.387487 \nLocal_gov_spending 1.273e-07 3.016e-06 0.042 0.966374 \nProgressivity 4.983e-03 1.324e-03 3.764 0.000205 ***\nEITC -3.324e-04 4.528e-04 -0.734 0.463549 \nSchool_spending -9.019e-04 2.272e-03 -0.397 0.691658 \nStudent_teacher_ratio -1.639e-03 1.123e-03 -1.459 0.145748 \nTest_scores 2.487e-04 3.137e-04 0.793 0.428519 \nHS_dropout -1.698e-01 9.352e-02 -1.816 0.070529 . \nColleges -2.811e-02 7.661e-02 -0.367 0.713942 \nTuition 3.459e-07 4.362e-07 0.793 0.428417 \nGraduation -1.702e-02 1.425e-02 -1.194 0.233650 \nLabor_force_participation -7.850e-02 5.405e-02 -1.452 0.147564 \nManufacturing -1.605e-01 2.816e-02 -5.700 3.1e-08 ***\nChinese_imports -5.165e-04 1.004e-03 -0.514 0.607378 \nTeenage_labor -1.019e+00 2.111e+00 -0.483 0.629639 \nMigration_in 4.490e-02 3.480e-01 0.129 0.897436 \nMigration_out -4.475e-01 4.093e-01 -1.093 0.275224 \nForeign_born 9.137e-02 5.494e-02 1.663 0.097454 . \nSocial_capital -1.114e-03 2.728e-03 -0.408 0.683245 \nReligious 4.570e-02 1.298e-02 3.520 0.000506 ***\nViolent_crime -3.393e+00 1.622e+00 -2.092 0.037373 * \nSingle_mothers -3.590e-01 9.442e-02 -3.802 0.000177 ***\nDivorced 1.707e-02 1.603e-01 0.107 0.915250 \nMarried -5.894e-02 7.246e-02 -0.813 0.416720 \nLongitude -4.239e-05 2.239e-04 -0.189 0.850001 \nLatitude 6.725e-04 5.687e-04 1.182 0.238037 \n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.02128 on 273 degrees of freedom\nMultiple R-squared: 0.7808, Adjusted R-squared: 0.7494 \nF-statistic: 24.93 on 39 and 273 DF, p-value: < 2.2e-16" }, { "objectID": "schedule/slides/02-lm-example.html#diagnostic-plots", "href": "schedule/slides/02-lm-example.html#diagnostic-plots", "title": "UBC Stat406 2024W", "section": "Diagnostic plots", - "text": "Diagnostic plots\n\n\npar(mar = c(5, 3, 0, 0))\nplot(full, 1)\n\n\n\n\n\n\n\n\n\n\n\nplot(full, 2)" + "text": "Diagnostic plots\n\n\nstuff <- tibble(\n residuals = residuals(full),\n fitted = fitted(full),\n stdresiduals = rstandard(full)\n)\nggplot(stuff, aes(fitted, residuals)) +\n geom_point() +\n geom_smooth(\n se = FALSE,\n colour = \"steelblue\",\n linewidth = 2\n ) +\n ggtitle(\"Residuals vs Fitted\")\n\n\n\n\n\n\n\n\n\n\n\nggplot(stuff, aes(sample = stdresiduals)) +\n geom_qq(size = 2) +\n geom_qq_line(linewidth = 2, color = \"steelblue\") +\n labs(\n x = \"Theoretical quantiles\",\n y = \"Standardized residuals\",\n title = \"Normal Q-Q\"\n )" }, { - "objectID": "schedule/slides/02-lm-example.html#section-1", - "href": "schedule/slides/02-lm-example.html#section-1", + "objectID": "schedule/slides/02-lm-example.html#can-also-just-use-dispatched-plot", + "href": "schedule/slides/02-lm-example.html#can-also-just-use-dispatched-plot", "title": "UBC Stat406 2024W", - "section": "", - "text": "(Those were plot methods for objects of class lm)\nSame thing in ggplot\n\n\nstuff <- tibble(\n residuals = residuals(full),\n fitted = fitted(full),\n stdresiduals = rstandard(full)\n)\nggplot(stuff, aes(fitted, residuals)) +\n geom_point(colour = \"salmon\") +\n geom_smooth(\n se = FALSE,\n colour = \"steelblue\",\n linewidth = 2\n ) +\n ggtitle(\"Residuals vs Fitted\")\n\n\n\n\n\n\n\n\n\n\n\nggplot(stuff, aes(sample = stdresiduals)) +\n geom_qq(colour = \"purple\", size = 2) +\n geom_qq_line(colour = \"peachpuff\", linewidth = 2) +\n labs(\n x = \"Theoretical quantiles\",\n y = \"Standardized residuals\",\n title = \"Normal Q-Q\"\n )" + "section": "Can also just use dispatched plot", + "text": "Can also just use dispatched plot\n\n\nplot(full, 1)\n\n\n\n\n\n\n\n\n\n\n\nplot(full, 2)" }, { "objectID": "schedule/slides/02-lm-example.html#fit-a-reduced-model", "href": "schedule/slides/02-lm-example.html#fit-a-reduced-model", "title": "UBC Stat406 2024W", "section": "Fit a reduced model", - "text": "Fit a reduced model\n\nreduced <- lm(\n Mobility ~ Commute + Gini_99 + Test_scores + HS_dropout +\n Manufacturing + Migration_in + Religious + Single_mothers,\n data = train\n)\n\nsummary(reduced)$coefficients |> as_tibble()\n\n# A tibble: 9 × 4\n Estimate `Std. Error` `t value` `Pr(>|t|)`\n <dbl> <dbl> <dbl> <dbl>\n1 0.166 0.0178 9.36 1.83e-18\n2 0.0637 0.0149 4.27 2.62e- 5\n3 -0.109 0.0390 -2.79 5.64e- 3\n4 0.000500 0.000256 1.95 5.19e- 2\n5 -0.216 0.0820 -2.64 8.81e- 3\n6 -0.159 0.0202 -7.89 5.65e-14\n7 -0.389 0.172 -2.26 2.42e- 2\n8 0.0436 0.0105 4.16 4.08e- 5\n9 -0.286 0.0466 -6.15 2.44e- 9\n\nreduced |>\n broom::glance() |>\n print(width = 120)\n\n# A tibble: 1 × 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>\n1 0.718 0.711 0.0229 96.9 5.46e-79 8 743. -1466. -1429.\n deviance df.residual nobs\n <dbl> <int> <int>\n1 0.159 304 313" + "text": "Fit a reduced model\n\nreduced <- lm(\n Mobility ~ Commute + Gini_99 + Test_scores + HS_dropout +\n Manufacturing + Migration_in + Religious + Single_mothers,\n data = train\n)\n\nsummary(reduced)$coefficients \n\n Estimate Std. Error t value Pr(>|t|)\n(Intercept) 0.1663344179 0.017769995 9.360409 1.829270e-18\nCommute 0.0637329409 0.014926382 4.269819 2.618234e-05\nGini_99 -0.1086058241 0.038958986 -2.787696 5.642726e-03\nTest_scores 0.0004997645 0.000256038 1.951915 5.186618e-02\nHS_dropout -0.2162067301 0.082003195 -2.636565 8.805228e-03\nManufacturing -0.1594229237 0.020215791 -7.886059 5.647668e-14\nMigration_in -0.3891567027 0.171839168 -2.264657 2.423771e-02\nReligious 0.0435673365 0.010463920 4.163577 4.084854e-05\nSingle_mothers -0.2864269552 0.046578928 -6.149282 2.444903e-09\n\nreduced |>\n broom::glance() |>\n print(width = 120)\n\n# A tibble: 1 × 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>\n1 0.718 0.711 0.0229 96.9 5.46e-79 8 743. -1466. -1429.\n deviance df.residual nobs\n <dbl> <int> <int>\n1 0.159 304 313" }, { "objectID": "schedule/slides/02-lm-example.html#diagnostic-plots-for-reduced-model", diff --git a/sitemap.xml b/sitemap.xml index c6d267a..53b3320 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,194 +2,194 @@ https://UBC-STAT.github.io/stat-406/schedule/slides/00-r-review.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/handouts/keras-nnet.html - 2024-09-12T14:52:23.518Z + 2024-09-14T15:54:43.952Z https://UBC-STAT.github.io/stat-406/schedule/slides/11-kernel-smoothers.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/09-l1-penalties.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/18-the-bootstrap.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/23-nnets-other.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/25-pca-issues.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/24-pca-intro.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/15-LDA-and-QDA.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/08-ridge-regression.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-quiz-0-wrap.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/27-kmeans.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/14-classification-intro.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/04-bias-variance.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-cv-for-many-models.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/01-lm-review.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/06-information-criteria.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/12-why-smooth.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-intro-to-class.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/handouts/lab00-git.html - 2024-09-12T14:52:23.518Z + 2024-09-14T15:54:43.956Z https://UBC-STAT.github.io/stat-406/course-setup.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/computing/windows.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/computing/mac_x86.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/computing/index.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/index.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/computing/mac_arm.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/computing/ubuntu.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/syllabus.html - 2024-09-12T14:52:23.550Z + 2024-09-14T15:54:43.988Z https://UBC-STAT.github.io/stat-406/schedule/index.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-course-review.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-version-control.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/faq.html - 2024-09-12T14:52:23.494Z + 2024-09-14T15:54:43.932Z https://UBC-STAT.github.io/stat-406/schedule/slides/21-nnets-intro.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/03-regression-function.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/19-bagging-and-rf.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/22-nnets-estimation.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/16-logistic-regression.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/20-boosting.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-classification-losses.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/10-basis-expansions.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/26-pca-v-kpca.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/13-gams-trees.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/05-estimating-test-mse.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/28-hclust.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/07-greedy-selection.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/02-lm-example.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z https://UBC-STAT.github.io/stat-406/schedule/slides/17-nonlinear-classifiers.html - 2024-09-12T14:52:23.526Z + 2024-09-14T15:54:43.964Z https://UBC-STAT.github.io/stat-406/schedule/slides/00-gradient-descent.html - 2024-09-12T14:52:23.522Z + 2024-09-14T15:54:43.960Z