Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
d-morrison committed May 21, 2024
1 parent f198cbd commit b4bb7cd
Show file tree
Hide file tree
Showing 98 changed files with 4,105 additions and 11,246 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45e6abd0
ddf9ed29
52 changes: 26 additions & 26 deletions Linear-models-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">Last modified: 2024-05-16: 13:44:16 (PM)</p>
<p class="date">Last modified: 2024-05-18: 7:52:50 (AM)</p>
</div>
</div>

Expand Down Expand Up @@ -906,7 +906,7 @@
</figcaption><div aria-describedby="tbl-coef-model1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<details class="code-fold"><summary>Show R code</summary><div class="sourceCode" id="cb8"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html">coef</a></span><span class="op">(</span><span class="va">bw_lm1</span><span class="op">)</span></span>
<span><span class="co">#&gt; (Intercept) sexmale age </span></span>
<span><span class="co">#&gt; -1773.32184 163.03930 120.89433</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span><span class="co">#&gt; -1773.3 163.0 120.9</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</figure>
Expand All @@ -929,7 +929,7 @@
\begin{aligned}
E[Y|A = 0, A = 36]
&amp;= \beta_0 + \beta_M \cdot 0+ \beta_A \cdot 36 \\
&amp;= 2578.873934
&amp;= 2578.8739
\end{aligned}
\]</span></p>
</div>
Expand Down Expand Up @@ -960,7 +960,7 @@
\begin{aligned}
E[Y|M = 1, A = 36]
&amp;= \beta_0 + \beta_M \cdot 1+ \beta_A \cdot 36 \\
&amp;= 2741.91323693
&amp;= 2741.9132
\end{aligned}
\]</span></p>
</div>
Expand All @@ -980,9 +980,9 @@
\begin{aligned}
&amp; E[Y|M = 1, A = 36] - E[Y|M = 0, A = 36]\\
&amp;=
2741.91323693 - 2578.873934\\
2741.9132 - 2578.8739\\
&amp;=
163.03930293
163.0393
\end{aligned}
\]</span></p>
<p>Shortcut:</p>
Expand All @@ -992,7 +992,7 @@
&amp;= (\beta_0 + \beta_M \cdot 1+ \beta_A \cdot 36) -
(\beta_0 + \beta_M \cdot 0+ \beta_A \cdot 36) \\
&amp;= \beta_M \\
&amp;= 163.03930293
&amp;= 163.0393
\end{aligned}
\]</span></p>
</div>
Expand Down Expand Up @@ -1131,7 +1131,7 @@
<p><span class="math display">\[
E[Y|A = 0, X_2 = 36] =
\beta_0 + \beta_M \cdot 0+ \beta_A \cdot 36 + \beta_{AM} \cdot (0 * 36)
= 2552.73333333
= 2552.7333
\]</span></p>
</div>
<hr>
Expand All @@ -1153,7 +1153,7 @@
\begin{aligned}
E[Y|A = 0, X_2 = 36]
&amp;= \beta_0 + \beta_M \cdot 1+ \beta_A \cdot 36 + \beta_{AM} \cdot 1 \cdot 36\\
&amp;= 2762.70689655
&amp;= 2762.7069
\end{aligned}
\]</span></p>
</div>
Expand All @@ -1169,7 +1169,7 @@
&amp;= (\beta_0 + \beta_M \cdot 1+ \beta_A \cdot 36 + \beta_{AM} \cdot 1 \cdot 36)\\
&amp;\ \ \ \ \ -(\beta_0 + \beta_M \cdot 0+ \beta_A \cdot 36 + \beta_{AM} \cdot 0 \cdot 36) \\
&amp;= \beta_{S} + \beta_{AM}\cdot 36\\
&amp;= 209.97356322
&amp;= 209.9736
\end{aligned}
\]</span></p>
</div>
Expand Down Expand Up @@ -1602,7 +1602,7 @@ <h3 class="anchored">Note</h3>
<p>Research question: is there really an interaction between sex and age?</p>
<p><span class="math inline">\(H_0: \beta_{AM} = 0\)</span></p>
<p><span class="math inline">\(H_A: \beta_{AM} \neq 0\)</span></p>
<p><span class="math inline">\(P(|\hat\beta_{AM}| &gt; |-18.41724138| \mid H_0)\)</span> = ?</p>
<p><span class="math inline">\(P(|\hat\beta_{AM}| &gt; |-18.4172| \mid H_0)\)</span> = ?</p>
</section><section id="wald-tests-and-cis" class="level3 smaller" data-number="2.4.2"><h3 class="smaller anchored" data-number="2.4.2" data-anchor-id="wald-tests-and-cis">
<span class="header-section-number">2.4.2</span> Wald tests and CIs</h3>
<p>R can give you Wald tests for single coefficients and corresponding CIs:</p>
Expand Down Expand Up @@ -1726,17 +1726,17 @@ <h3 class="anchored">Note</h3>
\begin{aligned}
&amp;P\left(
| \hat \beta_{AM} | &gt;
| -18.41724138| \middle| H_0
| -18.4172| \middle| H_0
\right)
\\
&amp;= \Pr \left(
\left| \frac{\hat\beta_{AM}}{\hat{SE}(\hat\beta_{AM})} \right| &gt;
\left| \frac{-18.41724138}{41.75581745} \right| \middle| H_0
\left| \frac{-18.4172}{41.7558} \right| \middle| H_0
\right)\\
&amp;= \Pr \left(
\left| T_{20} \right| &gt; 0.44107007 | H_0
\left| T_{20} \right| &gt; 0.4411 | H_0
\right)\\
&amp;= 0.66389342
&amp;= 0.6639
\end{aligned}
\]</span></p>
<div class="notes">
Expand Down Expand Up @@ -2329,12 +2329,12 @@ <h3 class="anchored">Note</h3>
</table>
</div>
</div>
<p>The likelihood ratio statistic for this test is <span class="math display">\[\lambda = 2 * (\ell_{\text{full}} - \ell) = 10.35537421\]</span> where:</p>
<p>The likelihood ratio statistic for this test is <span class="math display">\[\lambda = 2 * (\ell_{\text{full}} - \ell) = 10.3554\]</span> where:</p>
<ul>
<li>
<span class="math inline">\(\ell_{\text{max}}\)</span> is the log-likelihood of the full model: -151.40160056</li>
<span class="math inline">\(\ell_{\text{max}}\)</span> is the log-likelihood of the full model: -151.4016</li>
<li>
<span class="math inline">\(\ell\)</span> is the log-likelihood of our comparison model (two slopes, two intercepts): -156.57928767</li>
<span class="math inline">\(\ell\)</span> is the log-likelihood of our comparison model (two slopes, two intercepts): -156.5793</li>
</ul>
<p>This statistic is called the <strong>deviance</strong> or <strong>residual deviance</strong> for our two-slopes and two-intercepts model; it tells us how much the likelihood of that model deviates from the likelihood of the maximal model.</p>
<p>The corresponding p-value tells us whether there we have enough evidence to detect that our two-slopes, two-intercepts model is a worse fit for the data than the maximal model; in other words, it tells us if there’s evidence that we missed any important patterns. (Remember, a nonsignificant p-value could mean that we didn’t miss anything and a more complicated model is unnecessary, or it could mean we just don’t have enough data to tell the difference between these models.)</p>
Expand Down Expand Up @@ -2413,12 +2413,12 @@ <h3 class="anchored">Note</h3>
</table>
</div>
</div>
<p>The likelihood ratio statistic for the test comparing the null model to the maximal model is <span class="math display">\[\lambda = 2 * (\ell_{\text{full}} - \ell_{0}) = 35.10673188\]</span> where:</p>
<p>The likelihood ratio statistic for the test comparing the null model to the maximal model is <span class="math display">\[\lambda = 2 * (\ell_{\text{full}} - \ell_{0}) = 35.1067\]</span> where:</p>
<ul>
<li>
<span class="math inline">\(\ell_{\text{0}}\)</span> is the log-likelihood of the null model: -168.9549665</li>
<span class="math inline">\(\ell_{\text{0}}\)</span> is the log-likelihood of the null model: -168.955</li>
<li>
<span class="math inline">\(\ell_{\text{full}}\)</span> is the log-likelihood of the maximal model: -151.40160056</li>
<span class="math inline">\(\ell_{\text{full}}\)</span> is the log-likelihood of the maximal model: -151.4016</li>
</ul>
<p>In R, this test is:</p>
<div class="cell">
Expand Down Expand Up @@ -3926,15 +3926,15 @@ <h3 class="anchored">Note</h3>
<tbody>
<tr class="odd">
<td style="text-align: left;">full</td>
<td style="text-align: right;">6.946</td>
<td style="text-align: right;">6.958</td>
<td style="text-align: right;">0.4805</td>
<td style="text-align: right;">0.3831</td>
<td style="text-align: right;">5.956</td>
<td style="text-align: right;">-61.84</td>
</tr>
<tr class="even">
<td style="text-align: left;">reduced</td>
<td style="text-align: right;">6.627</td>
<td style="text-align: right;">6.778</td>
<td style="text-align: right;">0.4454</td>
<td style="text-align: right;">0.3802</td>
<td style="text-align: right;">5.971</td>
Expand Down Expand Up @@ -4071,10 +4071,10 @@ <h3 class="anchored">Note</h3>
<details class="code-fold"><summary>Show R code</summary><div class="sourceCode" id="cb105"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/stats/coef.html">coef</a></span><span class="op">(</span><span class="va">cvfit</span>, s <span class="op">=</span> <span class="st">"lambda.1se"</span><span class="op">)</span></span>
<span><span class="co">#&gt; 4 x 1 sparse Matrix of class "dgCMatrix"</span></span>
<span><span class="co">#&gt; s1</span></span>
<span><span class="co">#&gt; (Intercept) 34.4241</span></span>
<span><span class="co">#&gt; (Intercept) 34.1090</span></span>
<span><span class="co">#&gt; age . </span></span>
<span><span class="co">#&gt; weight -0.0662</span></span>
<span><span class="co">#&gt; protein 0.6607</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span><span class="co">#&gt; weight -0.1041</span></span>
<span><span class="co">#&gt; protein 0.9441</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
</section></section></section><section id="categorical-covariates-with-more-than-two-levels" class="level2" data-number="2.10"><h2 data-number="2.10" class="anchored" data-anchor-id="categorical-covariates-with-more-than-two-levels">
Expand Down
Binary file modified Linear-models-overview_files/figure-html/unnamed-chunk-104-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Linear-models-overview_files/figure-html/unnamed-chunk-98-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Regression-Models-for-Epidemiology.pdf
Binary file not shown.
969 changes: 649 additions & 320 deletions count-regression.html

Large diffs are not rendered by default.

Binary file modified count-regression_files/figure-html/fig-needles-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions coxph-model-building.html
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,8 @@
<p>The nature of time-to-event data results in very wide prediction intervals:</p>
<ul>
<li>Suppose a cancer patient is predicted to have a mean lifetime of 5 years after diagnosis and suppose the distribution is exponential.</li>
<li>If we want a 95% interval for survival, the lower end is at the 0.025 percentage point of the exponential which is <code>qexp(.025, rate = 1/5)</code> = 0.12658904 years, or 1/40 of the mean lifetime.</li>
<li>The upper end is at the 0.975 point which is <code>qexp(.975, rate = 1/5)</code> = 18.44439727 years, or 3.7 times the mean lifetime.</li>
<li>If we want a 95% interval for survival, the lower end is at the 0.025 percentage point of the exponential which is <code>qexp(.025, rate = 1/5)</code> = 0.1266 years, or 1/40 of the mean lifetime.</li>
<li>The upper end is at the 0.975 point which is <code>qexp(.975, rate = 1/5)</code> = 18.4444 years, or 3.7 times the mean lifetime.</li>
<li>Saying that the survival time is somewhere between 6 weeks and 18 years does not seem very useful, but it may be the best we can do.</li>
<li>For survival analysis, something is like a residual if it is small when the model is accurate or if the accumulation of them is in some way minimized by the estimation algorithm, but there is no exact equivalence to linear regression residuals.</li>
<li>And if there is, they are mostly quite large!</li>
Expand Down
Binary file added images/Songofthecount.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ <h2 id="toc-title">Table of contents</h2>
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">Last modified: 2024-05-16: 19:54:50 (PM)</p>
<p class="date">Last modified: 2024-05-21: 12:59:54 (PM)</p>
</div>
</div>

Expand Down
12 changes: 6 additions & 6 deletions intro-MLEs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1071,10 +1071,10 @@
<div class="proof solution">
<p><span class="proof-title"><em>Solution</em>. </span><span class="math display">\[
\begin{aligned}
\mathcal{L}(\lambda; \tilde x)
&amp;= P(\tilde X = \tilde x) \\
&amp;= P(X_1 = x_1, X_2 = x_2, ..., X_{13} = x_{13}) \\
&amp;= \prod_{i=1}^{13} P(X_i = x_i) \\
\mathcal{L}(\lambda; \tilde{x})
&amp;= \text{P}(\tilde{X}= \tilde{x}) \\
&amp;= \text{P}(X_1 = x_1, X_2 = x_2, ..., X_{13} = x_{13}) \\
&amp;= \prod_{i=1}^{13} \text{P}(X_i = x_i) \\
&amp;= \prod_{i=1}^{13} \frac{\lambda^{x_i} e^{-\lambda}}{x_i!}
\end{aligned}
\]</span></p>
Expand Down Expand Up @@ -1299,7 +1299,7 @@
<details class="code-fold"><summary>Show R code</summary><div class="sourceCode" id="cb11"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va">mle</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op">(</span><span class="va">cyclones</span><span class="op">$</span><span class="va">number</span><span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</details>
</div>
<p><span class="math display">\[\hat{\lambda}_{\text{ML}} = \bar x = 5.53846154\]</span></p>
<p><span class="math display">\[\hat{\lambda}_{\text{ML}} = \bar x = 5.5385\]</span></p>
</div>
</div>
<div id="exr-graph-mle" class="theorem exercise">
Expand Down Expand Up @@ -2082,7 +2082,7 @@
</details><div class="cell-output-display">
<div data-pagedtable="false">
<script data-pagedtable-source="" type="application/json">
{"columns":[{"label":["mu-hat"],"name":[1],"type":["dbl"],"align":["right"]},{"label":["sigma-hat"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["se_hat"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["confint_left"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["confint_right"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["tstat"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["pval"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["confint covers true mu"],"name":[8],"type":["lgl"],"align":["right"]},{"label":["test rejects null hypothesis"],"name":[9],"type":["lgl"],"align":["right"]}],"data":[{"1":"99.54","2":"10.63","3":"1.063","4":"97.43","5":"101.7","6":"10.11","7":"6.244e-17","8":"TRUE","9":"TRUE"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
{"columns":[{"label":["mu-hat"],"name":[1],"type":["dbl"],"align":["right"]},{"label":["sigma-hat"],"name":[2],"type":["dbl"],"align":["right"]},{"label":["se_hat"],"name":[3],"type":["dbl"],"align":["right"]},{"label":["confint_left"],"name":[4],"type":["dbl"],"align":["right"]},{"label":["confint_right"],"name":[5],"type":["dbl"],"align":["right"]},{"label":["tstat"],"name":[6],"type":["dbl"],"align":["right"]},{"label":["pval"],"name":[7],"type":["dbl"],"align":["right"]},{"label":["confint covers true mu"],"name":[8],"type":["lgl"],"align":["right"]},{"label":["test rejects null hypothesis"],"name":[9],"type":["lgl"],"align":["right"]}],"data":[{"1":"97.63","2":"10.76","3":"1.076","4":"95.5","5":"99.76","6":"8.216","7":"8.264e-13","8":"TRUE","9":"TRUE"}],"options":{"columns":{"min":{},"max":[10]},"rows":{"min":[10],"max":[10]},"pages":{}}}
</script>
</div>
</div>
Expand Down
Loading

0 comments on commit b4bb7cd

Please sign in to comment.