Skip to content

Commit

Permalink
build_quarto_site(unfreeze = FALSE) for release 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jabenninghoff committed May 1, 2024
1 parent 67464f2 commit 9cdcac8
Show file tree
Hide file tree
Showing 42 changed files with 1,958 additions and 40 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Notebooks in this package:
inspired by a 2015 blog
[post](https://statmodeling.stat.columbia.edu/2015/07/09/hey-guess-what-there-really-is-a-hot-hand/)
on the hot hand.
- [Constraints vs
Performance](https://jabenninghoff.github.io/rtraining/analysis/constraints.html)
(2024-04-30): Visualizations exploring the use of constraints vs
performance improvements in risk management.
- [ggplot2 (Getting
started)](https://jabenninghoff.github.io/rtraining/analysis/ggplot2-1.html)
(2022-11-20): Workbook for completing quizzes and exercises from the
Expand Down
17 changes: 17 additions & 0 deletions _freeze/analysis/constraints/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"hash": "aba248afd6fb391afb3f2368db154646",
"result": {
"engine": "knitr",
"markdown": "---\ntitle: \"Constraints vs Performance\"\nauthor: \"John Benninghoff\"\ndate: '2024-04-30'\ndate-modified: '2024-04-30'\ncategories: notes\norder: 107\noutput:\n html_notebook:\n theme:\n version: 5\n preset: bootstrap\n css: assets/extra.css\n pandoc_args: --shift-heading-level-by=1\n toc: yes\n toc_float:\n collapsed: no\n smooth_scroll: no\n---\n\n\nVisualizations exploring the use of constraints vs performance improvements in risk management.\n\n# Questions/TODO\n\n- [ ] Questions/TODO list here\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(ggplot2)\nlibrary(jbplot)\nlibrary(fs)\n```\n:::\n\n\n# Normal Performance\n\nReplicate a version of Figure 9 from the\n[Safety-II White Paper](https://www.england.nhs.uk/signuptosafety/wp-content/uploads/sites/16/2015/10/safety-1-safety-2-whte-papr.pdf),\nwith help from <https://ggplot2tutor.com/tutorials/sampling_distributions>:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nxmin <- -5\nxmax <- 5\n\nsave_png <- function(filename) {\n ggsave(filename = path(\"rendered\", filename), width = 16 * 0.6, height = 9 * 0.6, bg = \"white\")\n}\n\nbackground <- ggplot(data.frame(x = c(xmin, xmax)), aes(x)) +\n scale_x_continuous(breaks = -3:3, minor_breaks = NULL) +\n labs(x = NULL, y = NULL) +\n theme_quo(minor.y = FALSE)\n\nbaseline <- stat_function(fun = dnorm, geom = \"line\")\nbad <- stat_function(fun = dnorm, geom = \"area\", fill = \"red\", xlim = c(xmin, -2))\n\nbackground + bad + baseline\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/background-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"01-baseline-bad.png\")\n```\n:::\n\n\nThe plot above shows \"bad\" outcomes in red. Let's add in \"good\" outcomes (>1) in green:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ngood <- stat_function(fun = dnorm, geom = \"area\", fill = \"green\", xlim = c(1, xmax))\n\nbackground + bad + good + baseline\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/good-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"02-baseline-bad-good.png\")\n```\n:::\n\n\n# Constrained Performance\n\nOne way of reducing \"bad\" outcomes is by constraining performance - reducing the standard\ndeviation.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nconstrained <- stat_function(fun = dnorm, args = list(sd = 0.7), geom = \"line\", color = \"blue\")\ntaller <- scale_y_continuous(limits = c(0, 0.6))\n\nbackground +\n stat_function(\n fun = dnorm, args = list(sd = 0.7), geom = \"area\", fill = \"red\", xlim = c(xmin, -2)\n ) +\n stat_function(\n fun = dnorm, args = list(sd = 0.7), geom = \"area\", fill = \"green\", xlim = c(1, xmax)\n ) +\n constrained +\n taller\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/constrained-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"03-constrained.png\")\n```\n:::\n\n\nPlotting both on the same grid shows the reduction in both \"bad\" and \"good\" outcomes:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nbackground +\n bad +\n good +\n baseline +\n constrained +\n taller\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/overlay-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"04-baseline-constrained.png\")\n```\n:::\n\n\n# Improved Performance\n\nAnother way of reducing bad outcomes is by improving performance - shifting the mean.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nperformance <- stat_function(fun = dnorm, args = list(mean = 1), geom = \"line\", color = \"blue\")\nimproved <- stat_function(\n fun = dnorm, args = list(mean = 1), geom = \"area\", fill = \"green\", xlim = c(1, xmax)\n)\n\nbackground +\n stat_function(\n fun = dnorm, args = list(mean = 1), geom = \"area\", fill = \"red\", xlim = c(xmin, -2)\n ) +\n improved +\n performance\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/performance-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"05-improved.png\")\n```\n:::\n\n\nPlotting both together shows a reduction in \"bad\" and an increase in \"good\" outcomes:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nbackground +\n bad +\n improved +\n baseline +\n performance\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/overlay_perf-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"06-baseline-improved.png\")\n```\n:::\n\n\nComparing all three:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nbackground +\n bad +\n improved +\n baseline +\n constrained +\n performance +\n taller\n```\n\n::: {.cell-output-display}\n![](constraints_files/figure-html/overlay_all-1.png){width=816}\n:::\n\n```{.r .cell-code}\nsave_png(\"07-baseline-constrained-improved.png\")\n```\n:::\n",
"supporting": [
"constraints_files"
],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
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.
6 changes: 6 additions & 0 deletions docs/LICENSE.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<a href="./analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
15 changes: 14 additions & 1 deletion docs/NEWS.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<a href="./analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down Expand Up @@ -229,7 +235,8 @@
<h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#rtraining-1.2.2" id="toc-rtraining-1.2.2" class="nav-link active" data-scroll-target="#rtraining-1.2.2">rtraining 1.2.2</a></li>
<li><a href="#rtraining-1.2.3" id="toc-rtraining-1.2.3" class="nav-link active" data-scroll-target="#rtraining-1.2.3">rtraining 1.2.3</a></li>
<li><a href="#rtraining-1.2.2" id="toc-rtraining-1.2.2" class="nav-link" data-scroll-target="#rtraining-1.2.2">rtraining 1.2.2</a></li>
<li><a href="#rtraining-1.2.1" id="toc-rtraining-1.2.1" class="nav-link" data-scroll-target="#rtraining-1.2.1">rtraining 1.2.1</a></li>
<li><a href="#rtraining-1.2.0" id="toc-rtraining-1.2.0" class="nav-link" data-scroll-target="#rtraining-1.2.0">rtraining 1.2.0</a></li>
<li><a href="#rtraining-1.1.10" id="toc-rtraining-1.1.10" class="nav-link" data-scroll-target="#rtraining-1.1.10">rtraining 1.1.10</a></li>
Expand Down Expand Up @@ -317,6 +324,12 @@ <h2 id="toc-title">On this page</h2>



<section id="rtraining-1.2.3" class="level1">
<h1>rtraining 1.2.3</h1>
<ul>
<li>Added Constraints vs Performance: Visualizations exploring the use of constraints vs performance improvements in risk management.</li>
</ul>
</section>
<section id="rtraining-1.2.2" class="level1">
<h1>rtraining 1.2.2</h1>
<ul>
Expand Down
6 changes: 6 additions & 0 deletions docs/TODO.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<a href="./analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
6 changes: 6 additions & 0 deletions docs/analysis/FaultTree.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
12 changes: 9 additions & 3 deletions docs/analysis/advanced-r-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../analysis/advanced-r-2.html" rel="next">
<link href="../analysis/hockey-cards.html" rel="prev">
<link href="../analysis/constraints.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
Expand Down Expand Up @@ -202,6 +202,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down Expand Up @@ -5628,8 +5634,8 @@ <h3 class="anchored" data-anchor-id="exercises-27">8.6.6 Exercises</h3>
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="../analysis/hockey-cards.html" class="pagination-link" aria-label="Hockey Cards Analysis">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Hockey Cards Analysis</span>
<a href="../analysis/constraints.html" class="pagination-link" aria-label="Constraints vs Performance">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Constraints vs Performance</span>
</a>
</div>
<div class="nav-page nav-page-next">
Expand Down
6 changes: 6 additions & 0 deletions docs/analysis/advanced-r-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
6 changes: 6 additions & 0 deletions docs/analysis/advanced-r-3.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
6 changes: 6 additions & 0 deletions docs/analysis/advanced-r-4.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
6 changes: 6 additions & 0 deletions docs/analysis/cond-prob.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@
<a href="../analysis/hockey-cards.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Hockey Cards Analysis</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../analysis/constraints.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Constraints vs Performance</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
Loading

0 comments on commit 9cdcac8

Please sign in to comment.