-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build_quarto_site(unfreeze = FALSE) for release 1.2.3
- Loading branch information
1 parent
67464f2
commit 9cdcac8
Showing
42 changed files
with
1,958 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.