Skip to content

Commit

Permalink
0102 dgplot image fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanrongen committed Feb 1, 2024
1 parent 6257504 commit 368ea3b
Show file tree
Hide file tree
Showing 34 changed files with 21 additions and 29 deletions.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 9 additions & 17 deletions _site/materials/glm-practical-logistic-binary.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,15 +598,7 @@ <h1 class="title">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure"><p><img src="glm-practical-logistic-binary_files/figure-html/unnamed-chunk-15-1.png" class="img-fluid figure-img" width="96"></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure"><p><img src="images/dgplots/2024_01_31-02-26-30_PM_dgplots.png" class="img-fluid figure-img" width="804"></p>
<figure class="figure"><p><img src="images/dgplots/2024_02_01-07-29-38_AM_dgplots.png" class="img-fluid figure-img" width="805"></p>
</figure>
</div>
</div>
Expand Down Expand Up @@ -751,8 +743,8 @@ <h1 class="title">
Model Family: Binomial Df Model: 1
Link Function: Logit Scale: 1.0000
Method: IRLS Log-Likelihood: -4.5939
Date: Wed, 31 Jan 2024 Deviance: 9.1879
Time: 14:26:31 Pearson chi2: 15.1
Date: Thu, 01 Feb 2024 Deviance: 9.1879
Time: 07:29:39 Pearson chi2: 15.1
No. Iterations: 8 Pseudo R-squ. (CS): 0.7093
Covariance Type: nonrobust
==============================================================================
Expand Down Expand Up @@ -1002,7 +994,7 @@ <h1 class="title">
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>(ggplot(glm_bks_py_resid,</span>
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a> aes(x <span class="op">=</span> <span class="st">"obs"</span>,</span>
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> <span class="st">"cooks_d"</span>)) <span class="op">+</span></span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a> geom_segment(aes(x <span class="op">=</span> <span class="st">"obs"</span>,y <span class="op">=</span> <span class="st">"cooks_d"</span>, xend <span class="op">=</span> <span class="st">"obs"</span>, yend <span class="op">=</span> <span class="dv">0</span>)) <span class="op">+</span></span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a> geom_segment(aes(x <span class="op">=</span> <span class="st">"obs"</span>, y <span class="op">=</span> <span class="st">"cooks_d"</span>, xend <span class="op">=</span> <span class="st">"obs"</span>, yend <span class="op">=</span> <span class="dv">0</span>)) <span class="op">+</span></span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a> geom_point())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<div>
Expand Down Expand Up @@ -1085,8 +1077,8 @@ <h1 class="title">
Model Family: Binomial Df Model: 0
Link Function: Logit Scale: 1.0000
Method: IRLS Log-Likelihood: -42.274
Date: Wed, 31 Jan 2024 Deviance: 84.548
Time: 14:26:35 Pearson chi2: 61.0
Date: Thu, 01 Feb 2024 Deviance: 84.548
Time: 07:29:43 Pearson chi2: 61.0
No. Iterations: 3 Pseudo R-squ. (CS): 0.000
Covariance Type: nonrobust
==============================================================================
Expand Down Expand Up @@ -1140,7 +1132,7 @@ <h1 class="title">
<p>This shouldn’t be surprising since we already saw that our overall model was better than the null model, which in this case is exactly the same as asking whether the beak length term is significant. However, in more complicated models with multiple predictors these two comparisons (and p-values) won’t be the same.</p>
</div>
<div id="tabset-15-2" class="tab-pane" role="tabpanel" aria-labelledby="tabset-15-2-tab">
<p>Alas, for some inexplicable reason this is not (yet?) possible to do in Python. At least, not beknownst to me…</p>
<p>Alas, for some inexplicable reason this is not (yet?) possible to do in Python. At least, unbeknownst to me…</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -1356,8 +1348,8 @@ <h1 class="title">
Model Family: Binomial Df Model: 1
Link Function: Logit Scale: 1.0000
Method: IRLS Log-Likelihood: -376.10
Date: Wed, 31 Jan 2024 Deviance: 752.20
Time: 14:26:37 Pearson chi2: 713.
Date: Thu, 01 Feb 2024 Deviance: 752.20
Time: 07:29:45 Pearson chi2: 713.
No. Iterations: 4 Pseudo R-squ. (CS): 0.2238
Covariance Type: nonrobust
==============================================================================
Expand Down
10 changes: 5 additions & 5 deletions _site/search.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions materials/glm-practical-logistic-binary.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,14 @@ lm_bks_py = model.fit()
Next, we can create the diagnostic plots:
```{python}
#| eval: false
#| results: hide
dgplots(lm_bks_py)
```

```{python}
#| echo: false
#| fig-keep: none
#| fig-show: hide
# load dgplots function for knitr
exec(open('setup_files/dgplots_knitr.py').read())
# create rendered diagnostic plots image
Expand Down Expand Up @@ -368,7 +371,6 @@ There’s a lot to unpack here, but let's start with what we're familiar with: c
## Parameter interpretation

::: {.panel-tabset group="language"}

## R

The coefficients or parameters can be found in the `Coefficients` block. The main numbers to extract from the output are the two numbers underneath `Estimate.Std`:
Expand Down Expand Up @@ -574,7 +576,7 @@ We can use these to create the plot:
(ggplot(glm_bks_py_resid,
aes(x = "obs",
y = "cooks_d")) +
geom_segment(aes(x = "obs",y = "cooks_d", xend = "obs", yend = 0)) +
geom_segment(aes(x = "obs", y = "cooks_d", xend = "obs", yend = 0)) +
geom_point())
```

Expand Down Expand Up @@ -673,13 +675,11 @@ This shouldn’t be surprising since we already saw that our overall model was b

## Python

Alas, for some inexplicable reason this is not (yet?) possible to do in Python. At least, not beknownst to me...
Alas, for some inexplicable reason this is not (yet?) possible to do in Python. At least, unbeknownst to me...

:::




## Exercises

### Diabetes {#sec-exr_diabetes}
Expand Down
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 368ea3b

Please sign in to comment.