diff --git a/.nojekyll b/.nojekyll index d4bc224..f98f34e 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -48479f2e \ No newline at end of file +59a3177a \ No newline at end of file diff --git a/Linear-models-overview.html b/Linear-models-overview.html index fab2a31..5f43330 100644 --- a/Linear-models-overview.html +++ b/Linear-models-overview.html @@ -3925,7 +3925,7 @@

Note

full -6.829 +6.818 0.4805 0.3831 5.956 @@ -3933,7 +3933,7 @@

Note

reduced -6.548 +6.458 0.4454 0.3802 5.971 @@ -4069,11 +4069,11 @@

Note

Show R code
coef(cvfit, s = "lambda.1se")
 #> 4 x 1 sparse Matrix of class "dgCMatrix"
-#>                   s1
-#> (Intercept) 34.30916
-#> age          .      
-#> weight      -0.08001
-#> protein      0.76405
+#> s1 +#> (Intercept) 34.4241 +#> age . +#> weight -0.0662 +#> protein 0.6607

diff --git a/Linear-models-overview_files/figure-html/unnamed-chunk-104-1.png b/Linear-models-overview_files/figure-html/unnamed-chunk-104-1.png index 8cce109..a105c18 100644 Binary files a/Linear-models-overview_files/figure-html/unnamed-chunk-104-1.png and b/Linear-models-overview_files/figure-html/unnamed-chunk-104-1.png differ diff --git a/Linear-models-overview_files/figure-html/unnamed-chunk-98-1.png b/Linear-models-overview_files/figure-html/unnamed-chunk-98-1.png index b6a55ff..ebce814 100644 Binary files a/Linear-models-overview_files/figure-html/unnamed-chunk-98-1.png and b/Linear-models-overview_files/figure-html/unnamed-chunk-98-1.png differ diff --git a/Regression-Models-for-Epidemiology.pdf b/Regression-Models-for-Epidemiology.pdf index 977273b..18052d9 100644 Binary files a/Regression-Models-for-Epidemiology.pdf and b/Regression-Models-for-Epidemiology.pdf differ diff --git a/index.html b/index.html index e9f4f53..b0fb48e 100644 --- a/index.html +++ b/index.html @@ -395,7 +395,7 @@

Table of contents

Published
-

Last modified: 2024-08-24: 14:45:15 (PM)

+

Last modified: 2024-09-19: 16:24:35 (PM)

diff --git a/intro-MLEs.html b/intro-MLEs.html index 1cda73c..a85e184 100644 --- a/intro-MLEs.html +++ b/intro-MLEs.html @@ -2077,7 +2077,7 @@
diff --git a/logistic-regression.html b/logistic-regression.html index bca314c..1adfa01 100644 --- a/logistic-regression.html +++ b/logistic-regression.html @@ -3718,8 +3718,8 @@

<
ggplotly(HL_plot)
-
- +
+

@@ -3870,8 +3870,8 @@

wcgs_response_resid_plot |> ggplotly()
-
- +
+

We can see a slight fan-shape here: observations on the right have larger variance (as expected since \(var(\bar y) = \pi(1-\pi)/n\) is maximized when \(\pi = 0.5\)).

@@ -4007,8 +4007,8 @@

Re
wcgs_resid_plot1 |> ggplotly()
-
- +
+
diff --git a/probability.html b/probability.html index aa86b30..c077e0a 100644 --- a/probability.html +++ b/probability.html @@ -362,6 +362,7 @@
  • C.4.4 Variance and related characteristics
  • +
  • C.5 The Central Limit Theorem
  • @@ -377,7 +378,7 @@
    Published
    -

    Last modified: 2024-06-11: 15:25:57 (PM)

    +

    Last modified: 2024-09-19: 16:24:35 (PM)

    @@ -1072,11 +1073,84 @@

    Definition C.23 (Conditionally independent and identically distributed) A set of random variables \(Y_1, \ldots, Y_n\) are conditionally independent and identically distributed (shorthand: “\(Y_i | X_i\ \text{ciid}\)” or just “\(Y_i |X_i\ \text{iid}\)”) given a set of covariates \(X_1, \ldots, X_n\) if \(Y_1, \ldots, Y_n\) are conditionally independent given \(X_1, \ldots, X_n\) and \(Y_1, \ldots, Y_n\) are identically distributed given \(X_1, \ldots, X_n\).

    +

    +C.5 The Central Limit Theorem

    +

    The sum of many independent or nearly-independent random variables with small variances (relative to the number of RVs being summed) produces bell-shaped distributions.

    +

    For example, consider the sum of five dice (Figure C.4).

    +
    +
    Show R code
    library(dplyr)
    +dist = 
    +  expand.grid(1:6, 1:6, 1:6, 1:6, 1:6) |> 
    +  rowwise() |>
    +  mutate(total = sum(c_across(everything()))) |> 
    +  ungroup() |> 
    +  count(total) |> 
    +  mutate(`p(X=x)` = n/sum(n))
    +
    +library(ggplot2)
    +
    +dist |> 
    +  ggplot() +
    +  aes(x = total, y = `p(X=x)`) +
    +  geom_col() +
    +  xlab("sum of dice (x)") +
    +  ylab("Probability of outcome, Pr(X=x)") +
    +  expand_limits(y = 0)
    +
    +  
    +  
    +
    +
    +
    +Figure C.4: Distribution of the sum of five dice +
    + +
    +
    +
    +
    +
    +

    In comparison, the outcome of just one die is not bell-shaped (?fig-clt-2d6).

    +
    +
    Show R code
    library(dplyr)
    +dist = 
    +  expand.grid(1:6) |> 
    +  rowwise() |>
    +  mutate(total = sum(c_across(everything()))) |> 
    +  ungroup() |> 
    +  count(total) |> 
    +  mutate(`p(X=x)` = n/sum(n))
    +
    +library(ggplot2)
    +
    +dist |> 
    +  ggplot() +
    +  aes(x = total, y = `p(X=x)`) +
    +  geom_col() +
    +  xlab("sum of dice (x)") +
    +  ylab("Probability of outcome, Pr(X=x)") +
    +  expand_limits(y = 0)
    +
    +  
    +  
    +
    +
    +
    +Figure C.5: Distribution of the outcome of one die +
    + +
    +
    +
    +
    +
    +

    What distribution does a single die have?

    +

    Answer: discrete uniform on 1:6.

    -