From a068a93487cec054eea81ebad704c1b032fc588b Mon Sep 17 00:00:00 2001 From: Ken Butler Date: Tue, 12 Nov 2024 10:44:07 -0500 Subject: [PATCH] tidy windmill --- _freeze/tidy_extra/execute-results/html.json | 4 +- _freeze/tidy_extra/execute-results/tex.json | 4 +- .../figure-beamer/tidy-extra-R-19-1.pdf | Bin 6817 -> 6817 bytes .../figure-beamer/tidy-extra-R-20-1.pdf | Bin 5442 -> 5442 bytes _freeze/windmill/execute-results/html.json | 4 +- _freeze/windmill/execute-results/tex.json | 4 +- _freeze/windmill/figure-beamer/resida-1.pdf | Bin 6841 -> 6145 bytes .../figure-beamer/unnamed-chunk-1-1.pdf | Bin 6856 -> 6153 bytes .../figure-beamer/unnamed-chunk-3-1.pdf | Bin 6899 -> 6196 bytes .../figure-beamer/unnamed-chunk-4-1.pdf | Bin 6890 -> 6187 bytes .../windmill/figure-beamer/windmill-11-1.pdf | Bin 7397 -> 6698 bytes .../windmill/figure-beamer/windmill-13-1.pdf | Bin 6894 -> 6193 bytes .../windmill/figure-beamer/windmill-18-1.pdf | Bin 6877 -> 6176 bytes .../windmill/figure-beamer/windmill-19-1.pdf | Bin 7560 -> 6861 bytes .../windmill/figure-beamer/windmill-20-1.pdf | Bin 7467 -> 6768 bytes .../windmill/figure-beamer/windmill-25-1.pdf | Bin 7618 -> 6919 bytes .../windmill/figure-beamer/windmill-35-1.pdf | Bin 6096 -> 5397 bytes .../windmill/figure-beamer/windmill-5-1.pdf | Bin 7518 -> 6820 bytes .../libs/revealjs/dist/theme/quarto.css | 4 +- _targets/meta/meta | 10 +- tidy_extra.html | 34 +++-- tidy_extra.pdf | Bin 51991 -> 52625 bytes tidy_extra.qmd | 1 + windmill.html | 122 +++++++++++++----- windmill.pdf | Bin 156779 -> 153203 bytes windmill.qmd | 6 +- 26 files changed, 128 insertions(+), 65 deletions(-) diff --git a/_freeze/tidy_extra/execute-results/html.json b/_freeze/tidy_extra/execute-results/html.json index d08054e..75e3a76 100644 --- a/_freeze/tidy_extra/execute-results/html.json +++ b/_freeze/tidy_extra/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "3040d90a398cec91bf22afebfac3da82", + "hash": "11ad401787c73e44649316a5337e8669", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Tidying data: extras\"\n---\n\n\n\n\n## Packages\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\n```\n:::\n\n\n\n\n## The pig feed data again\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/datafiles/pigs1.txt\"\npigs <- read_table(my_url)\npigs\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Make longer (as before)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs %>% pivot_longer(-pig, names_to=\"feed\", \n values_to=\"weight\") -> pigs_longer\npigs_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Make wider two ways 1/2\n\n`pivot_wider` is inverse of `pivot_longer`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=feed, values_from=weight)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nwe are back where we started.\n\n## Make wider 2/2\n\nOr\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=pig, values_from=weight)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Disease presence and absence at two locations\n\nFrequencies of plants observed with and without disease at two\nlocations:\n\n``` \nSpecies Disease present Disease absent\n Location X Location Y Location X Location Y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nThis has two rows of headers, so I rewrote the data file:\n\n``` \nSpecies present_x present_y absent_x absent_y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nRead into data frame called `prevalence`.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/disease.txt\"\nprevalence <- read_table(my_url)\nprevalence\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Lengthen and separate\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to = \"column\", \n values_to = \"freq\") %>% \n separate_wider_delim(column, \"_\", \n names = c(\"disease\", \"location\"))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making longer, the better way\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to=c(\"disease\", \"location\"),\n names_sep=\"_\", \n values_to=\"frequency\") -> prevalence_longer \nprevalence_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making wider, different ways\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=c(Species, location), values_from=frequency)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=location, values_from=frequency)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Interlude {.smaller}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(weight_mean=mean(weight))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## What if summary is more than one number?\n\neg. quartiles:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Following the hint...\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n reframe(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## this also works\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(quantile(weight, c(0.25, 0.75)))) %>% \n unnest(r)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## or, even better, use `enframe`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nquantile(pigs_longer$weight, c(0.25, 0.75))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n 25% 75% \n65.975 90.225 \n```\n\n\n:::\n\n```{.r .cell-code}\nenframe(quantile(pigs_longer$weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## A nice look\n\nRun this one line at a time to see how it works:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(enframe(quantile(weight, c(0.25, 0.75))))) %>% \n unnest(r) %>% \n pivot_wider(names_from=name, values_from=value) -> d\nd\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## A hairy one\n\n18 people receive one of three treatments. At 3 different times (pre,\npost, followup) two variables `y` and `z` are measured on each person:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/repmes.txt\"\nrepmes0 <- read_table(my_url)\nrepmes0\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\nrepmes0 %>% mutate(id=str_c(treatment, \".\", rep)) %>% \n select(-rep) %>% \n select(id, everything()) -> repmes\nrepmes\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) \n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Attempt 1\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \"var\"),\n names_sep=\"_\",\n values_to = \"vvv\"\n )\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nThis is *too* long! We wanted a column called `y` and a column called\n`z`, but they have been pivoted-longer too.\n\n## Attempt 2\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) -> repmes3\nrepmes3\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nThis has done what we wanted.\n\n## make a graph\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(repmes3, aes(x=fct_inorder(time), y=y, \n colour=treatment, group = id)) +\n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-revealjs/tidy-extra-R-19-1.png){width=960}\n:::\n:::\n\n\n\n\nA so-called spaghetti plot. The three measurements for each person are\njoined by lines, and the lines are coloured by treatment.\n\n## or do the plot with means\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes3 %>% group_by(treatment, ftime=fct_inorder(time)) %>% \n summarize(mean_y=mean(y)) %>% \n ggplot(aes(x=ftime, y=mean_y, colour=treatment, \n group=treatment)) + \n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-revealjs/tidy-extra-R-20-1.png){width=960}\n:::\n:::\n\n\n\n\nOn average, the two real treatments go up and level off, but the control\ngroup is very different.\n", + "markdown": "---\ntitle: \"Tidying data: extras\"\n---\n\n\n\n\n## Packages\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\n```\n:::\n\n\n\n\n## The pig feed data again\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/datafiles/pigs1.txt\"\npigs <- read_table(my_url)\npigs\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Make longer (as before)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs %>% pivot_longer(-pig, names_to=\"feed\", \n values_to=\"weight\") -> pigs_longer\npigs_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Make wider two ways 1/2\n\n`pivot_wider` is inverse of `pivot_longer`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=feed, values_from=weight)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nwe are back where we started.\n\n## Make wider 2/2\n\nOr\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=pig, values_from=weight)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Disease presence and absence at two locations\n\nFrequencies of plants observed with and without disease at two\nlocations:\n\n``` \nSpecies Disease present Disease absent\n Location X Location Y Location X Location Y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nThis has two rows of headers, so I rewrote the data file:\n\n``` \nSpecies present_x present_y absent_x absent_y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nRead into data frame called `prevalence`.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/disease.txt\"\nprevalence <- read_table(my_url)\nprevalence\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Lengthen and separate\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to = \"column\", \n values_to = \"freq\") %>% \n separate_wider_delim(column, \"_\", \n names = c(\"disease\", \"location\"))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making longer, the better way\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to=c(\"disease\", \"location\"),\n names_sep=\"_\", \n values_to=\"frequency\") -> prevalence_longer \nprevalence_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making wider, different ways\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=c(Species, location), values_from=frequency)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=location, values_from=frequency)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Interlude {.smaller}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(weight_mean=mean(weight))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## What if summary is more than one number?\n\neg. quartiles:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Following the hint...\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n reframe(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## this also works\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(quantile(weight, c(0.25, 0.75)))) %>% \n unnest(r)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## or, even better, use `enframe`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nquantile(pigs_longer$weight, c(0.25, 0.75))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n 25% 75% \n65.975 90.225 \n```\n\n\n:::\n\n```{.r .cell-code}\nenframe(quantile(pigs_longer$weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## A nice look\n\nRun this one line at a time to see how it works:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(enframe(quantile(weight, c(0.25, 0.75))))) %>% \n unnest(r) %>% \n pivot_wider(names_from=name, values_from=value) -> d\nd\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## A hairy one\n\n18 people receive one of three treatments. At 3 different times (pre,\npost, followup) two variables `y` and `z` are measured on each person:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/repmes.txt\"\nrepmes0 <- read_table(my_url)\nrepmes0\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\nrepmes0 %>% mutate(id=str_c(treatment, \".\", rep)) %>% \n select(-rep) %>% \n select(id, everything()) -> repmes\nrepmes\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) \n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Attempt 1\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \"var\"),\n names_sep=\"_\",\n values_to = \"vvv\"\n )\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nThis is *too* long! We wanted a column called `y` and a column called\n`z`, but they have been pivoted-longer too.\n\n## Attempt 2\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) -> repmes3\nrepmes3\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\nThis has done what we wanted.\n\n## make a graph\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(repmes3, aes(x=fct_inorder(time), y=y, \n colour=treatment, group = id)) +\n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-revealjs/tidy-extra-R-19-1.png){width=960}\n:::\n:::\n\n\n\n\nA so-called spaghetti plot. The three measurements for each person are\njoined by lines, and the lines are coloured by treatment.\n\n## or do the plot with means\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes3 %>% group_by(treatment, ftime=fct_inorder(time)) %>% \n summarize(mean_y=mean(y)) %>% \n ggplot(aes(x=ftime, y=mean_y, colour=treatment, \n group=treatment)) + \n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-revealjs/tidy-extra-R-20-1.png){width=960}\n:::\n:::\n\n\n\n\nOn average, the two real treatments go up and level off, but the control\ngroup is very different.\n", "supporting": [ "tidy_extra_files" ], diff --git a/_freeze/tidy_extra/execute-results/tex.json b/_freeze/tidy_extra/execute-results/tex.json index 0940879..13a341d 100644 --- a/_freeze/tidy_extra/execute-results/tex.json +++ b/_freeze/tidy_extra/execute-results/tex.json @@ -1,8 +1,8 @@ { - "hash": "3040d90a398cec91bf22afebfac3da82", + "hash": "11ad401787c73e44649316a5337e8669", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Tidying data: extras\"\n---\n\n\n\n\n## Packages\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\n```\n:::\n\n\n\n\n## The pig feed data again\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/datafiles/pigs1.txt\"\npigs <- read_table(my_url)\npigs\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 5 x 5\n pig feed1 feed2 feed3 feed4\n \n1 1 60.8 68.7 92.6 87.9\n2 2 57 67.7 92.1 84.2\n3 3 65 74 90.2 83.1\n4 4 58.6 66.3 96.5 85.7\n5 5 61.7 69.8 99.1 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Make longer (as before)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs %>% pivot_longer(-pig, names_to=\"feed\", \n values_to=\"weight\") -> pigs_longer\npigs_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 20 x 3\n pig feed weight\n \n 1 1 feed1 60.8\n 2 1 feed2 68.7\n 3 1 feed3 92.6\n 4 1 feed4 87.9\n 5 2 feed1 57 \n 6 2 feed2 67.7\n 7 2 feed3 92.1\n 8 2 feed4 84.2\n 9 3 feed1 65 \n10 3 feed2 74 \n11 3 feed3 90.2\n12 3 feed4 83.1\n13 4 feed1 58.6\n14 4 feed2 66.3\n15 4 feed3 96.5\n16 4 feed4 85.7\n17 5 feed1 61.7\n18 5 feed2 69.8\n19 5 feed3 99.1\n20 5 feed4 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Make wider two ways 1/2\n\n`pivot_wider` is inverse of `pivot_longer`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=feed, values_from=weight)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 5 x 5\n pig feed1 feed2 feed3 feed4\n \n1 1 60.8 68.7 92.6 87.9\n2 2 57 67.7 92.1 84.2\n3 3 65 74 90.2 83.1\n4 4 58.6 66.3 96.5 85.7\n5 5 61.7 69.8 99.1 90.3\n```\n\n\n:::\n:::\n\n\n\n\nwe are back where we started.\n\n## Make wider 2/2\n\nOr\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=pig, values_from=weight)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 6\n feed `1` `2` `3` `4` `5`\n \n1 feed1 60.8 57 65 58.6 61.7\n2 feed2 68.7 67.7 74 66.3 69.8\n3 feed3 92.6 92.1 90.2 96.5 99.1\n4 feed4 87.9 84.2 83.1 85.7 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Disease presence and absence at two locations\n\nFrequencies of plants observed with and without disease at two\nlocations:\n\n``` \nSpecies Disease present Disease absent\n Location X Location Y Location X Location Y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nThis has two rows of headers, so I rewrote the data file:\n\n``` \nSpecies present_x present_y absent_x absent_y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nRead into data frame called `prevalence`.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/disease.txt\"\nprevalence <- read_table(my_url)\nprevalence\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n Species present_x present_y absent_x absent_y\n \n1 A 44 12 38 10\n2 B 28 22 20 18\n```\n\n\n:::\n:::\n\n\n\n\n## Lengthen and separate\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to = \"column\", \n values_to = \"freq\") %>% \n separate_wider_delim(column, \"_\", \n names = c(\"disease\", \"location\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 4\n Species disease location freq\n \n1 A present x 44\n2 A present y 12\n3 A absent x 38\n4 A absent y 10\n5 B present x 28\n6 B present y 22\n7 B absent x 20\n8 B absent y 18\n```\n\n\n:::\n:::\n\n\n\n\n## Making longer, the better way\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n Species present_x present_y absent_x absent_y\n \n1 A 44 12 38 10\n2 B 28 22 20 18\n```\n\n\n:::\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to=c(\"disease\", \"location\"),\n names_sep=\"_\", \n values_to=\"frequency\") -> prevalence_longer \nprevalence_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 4\n Species disease location frequency\n \n1 A present x 44\n2 A present y 12\n3 A absent x 38\n4 A absent y 10\n5 B present x 28\n6 B present y 22\n7 B absent x 20\n8 B absent y 18\n```\n\n\n:::\n:::\n\n\n\n\n## Making wider, different ways\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=c(Species, location), values_from=frequency)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n disease A_x A_y B_x B_y\n \n1 present 44 12 28 22\n2 absent 38 10 20 18\n```\n\n\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=location, values_from=frequency)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 4\n Species disease x y\n \n1 A present 44 12\n2 A absent 38 10\n3 B present 28 22\n4 B absent 20 18\n```\n\n\n:::\n:::\n\n\n\n\n## Interlude {.smaller}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 20 x 3\n pig feed weight\n \n 1 1 feed1 60.8\n 2 1 feed2 68.7\n 3 1 feed3 92.6\n 4 1 feed4 87.9\n 5 2 feed1 57 \n 6 2 feed2 67.7\n 7 2 feed3 92.1\n 8 2 feed4 84.2\n 9 3 feed1 65 \n10 3 feed2 74 \n11 3 feed3 90.2\n12 3 feed4 83.1\n13 4 feed1 58.6\n14 4 feed2 66.3\n15 4 feed3 96.5\n16 4 feed4 85.7\n17 5 feed1 61.7\n18 5 feed2 69.8\n19 5 feed3 99.1\n20 5 feed4 90.3\n```\n\n\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(weight_mean=mean(weight))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 2\n feed weight_mean\n \n1 feed1 60.6\n2 feed2 69.3\n3 feed3 94.1\n4 feed4 86.2\n```\n\n\n:::\n:::\n\n\n\n\n## What if summary is more than one number?\n\neg. quartiles:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n# Groups: feed [4]\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## Following the hint...\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n reframe(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## this also works\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n# Groups: feed [4]\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(quantile(weight, c(0.25, 0.75)))) %>% \n unnest(r)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## or, even better, use `enframe`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nquantile(pigs_longer$weight, c(0.25, 0.75))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n 25% 75% \n65.975 90.225 \n```\n\n\n:::\n\n```{.r .cell-code}\nenframe(quantile(pigs_longer$weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 2\n name value\n \n1 25% 66.0\n2 75% 90.2\n```\n\n\n:::\n:::\n\n\n\n\n## A nice look\n\nRun this one line at a time to see how it works:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(enframe(quantile(weight, c(0.25, 0.75))))) %>% \n unnest(r) %>% \n pivot_wider(names_from=name, values_from=value) -> d\nd\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 3\n feed `25%` `75%`\n \n1 feed1 58.6 61.7\n2 feed2 67.7 69.8\n3 feed3 92.1 96.5\n4 feed4 84.2 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## A hairy one\n\n18 people receive one of three treatments. At 3 different times (pre,\npost, followup) two variables `y` and `z` are measured on each person:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/repmes.txt\"\nrepmes0 <- read_table(my_url)\nrepmes0\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 18 x 8\n treatment rep pre_y post_y fu_y pre_z post_z fu_z\n \n 1 A 1 3 13 9 0 0 9\n 2 A 2 0 14 10 6 6 3\n 3 A 3 4 6 17 8 2 6\n 4 A 4 7 7 13 7 6 4\n 5 A 5 3 12 11 6 12 6\n 6 A 6 10 14 8 13 3 8\n 7 B 1 9 11 17 8 11 27\n 8 B 2 4 16 13 9 3 26\n 9 B 3 8 10 9 12 0 18\n10 B 4 5 9 13 3 0 14\n11 B 5 0 15 11 3 0 25\n12 B 6 4 11 14 4 2 9\n13 Control 1 10 12 15 4 3 7\n14 Control 2 2 8 12 8 7 20\n15 Control 3 4 9 10 2 0 10\n16 Control 4 10 8 8 5 8 14\n17 Control 5 11 11 11 1 0 11\n18 Control 6 1 5 15 8 9 10\n```\n\n\n:::\n\n```{.r .cell-code}\nrepmes0 %>% mutate(id=str_c(treatment, \".\", rep)) %>% \n select(-rep) %>% \n select(id, everything()) -> repmes\nrepmes\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 18 x 8\n id treatment pre_y post_y fu_y pre_z post_z fu_z\n \n 1 A.1 A 3 13 9 0 0 9\n 2 A.2 A 0 14 10 6 6 3\n 3 A.3 A 4 6 17 8 2 6\n 4 A.4 A 7 7 13 7 6 4\n 5 A.5 A 3 12 11 6 12 6\n 6 A.6 A 10 14 8 13 3 8\n 7 B.1 B 9 11 17 8 11 27\n 8 B.2 B 4 16 13 9 3 26\n 9 B.3 B 8 10 9 12 0 18\n10 B.4 B 5 9 13 3 0 14\n11 B.5 B 0 15 11 3 0 25\n12 B.6 B 4 11 14 4 2 9\n13 Control.1 Control 10 12 15 4 3 7\n14 Control.2 Control 2 8 12 8 7 20\n15 Control.3 Control 4 9 10 2 0 10\n16 Control.4 Control 10 8 8 5 8 14\n17 Control.5 Control 11 11 11 1 0 11\n18 Control.6 Control 1 5 15 8 9 10\n```\n\n\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) \n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 54 x 5\n id treatment time y z\n \n 1 A.1 A pre 3 0\n 2 A.1 A post 13 0\n 3 A.1 A fu 9 9\n 4 A.2 A pre 0 6\n 5 A.2 A post 14 6\n 6 A.2 A fu 10 3\n 7 A.3 A pre 4 8\n 8 A.3 A post 6 2\n 9 A.3 A fu 17 6\n10 A.4 A pre 7 7\n# i 44 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Attempt 1\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \"var\"),\n names_sep=\"_\",\n values_to = \"vvv\"\n )\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 108 x 5\n id treatment time var vvv\n \n 1 A.1 A pre y 3\n 2 A.1 A post y 13\n 3 A.1 A fu y 9\n 4 A.1 A pre z 0\n 5 A.1 A post z 0\n 6 A.1 A fu z 9\n 7 A.2 A pre y 0\n 8 A.2 A post y 14\n 9 A.2 A fu y 10\n10 A.2 A pre z 6\n# i 98 more rows\n```\n\n\n:::\n:::\n\n\n\n\nThis is *too* long! We wanted a column called `y` and a column called\n`z`, but they have been pivoted-longer too.\n\n## Attempt 2\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) -> repmes3\nrepmes3\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 54 x 5\n id treatment time y z\n \n 1 A.1 A pre 3 0\n 2 A.1 A post 13 0\n 3 A.1 A fu 9 9\n 4 A.2 A pre 0 6\n 5 A.2 A post 14 6\n 6 A.2 A fu 10 3\n 7 A.3 A pre 4 8\n 8 A.3 A post 6 2\n 9 A.3 A fu 17 6\n10 A.4 A pre 7 7\n# i 44 more rows\n```\n\n\n:::\n:::\n\n\n\n\nThis has done what we wanted.\n\n## make a graph\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(repmes3, aes(x=fct_inorder(time), y=y, \n colour=treatment, group = id)) +\n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-beamer/tidy-extra-R-19-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nA so-called spaghetti plot. The three measurements for each person are\njoined by lines, and the lines are coloured by treatment.\n\n## or do the plot with means\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes3 %>% group_by(treatment, ftime=fct_inorder(time)) %>% \n summarize(mean_y=mean(y)) %>% \n ggplot(aes(x=ftime, y=mean_y, colour=treatment, \n group=treatment)) + \n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-beamer/tidy-extra-R-20-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nOn average, the two real treatments go up and level off, but the control\ngroup is very different.\n", + "markdown": "---\ntitle: \"Tidying data: extras\"\n---\n\n\n\n\n## Packages\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\n```\n:::\n\n\n\n\n## The pig feed data again\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/datafiles/pigs1.txt\"\npigs <- read_table(my_url)\npigs\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 5 x 5\n pig feed1 feed2 feed3 feed4\n \n1 1 60.8 68.7 92.6 87.9\n2 2 57 67.7 92.1 84.2\n3 3 65 74 90.2 83.1\n4 4 58.6 66.3 96.5 85.7\n5 5 61.7 69.8 99.1 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Make longer (as before)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs %>% pivot_longer(-pig, names_to=\"feed\", \n values_to=\"weight\") -> pigs_longer\npigs_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 20 x 3\n pig feed weight\n \n 1 1 feed1 60.8\n 2 1 feed2 68.7\n 3 1 feed3 92.6\n 4 1 feed4 87.9\n 5 2 feed1 57 \n 6 2 feed2 67.7\n 7 2 feed3 92.1\n 8 2 feed4 84.2\n 9 3 feed1 65 \n10 3 feed2 74 \n11 3 feed3 90.2\n12 3 feed4 83.1\n13 4 feed1 58.6\n14 4 feed2 66.3\n15 4 feed3 96.5\n16 4 feed4 85.7\n17 5 feed1 61.7\n18 5 feed2 69.8\n19 5 feed3 99.1\n20 5 feed4 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Make wider two ways 1/2\n\n`pivot_wider` is inverse of `pivot_longer`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=feed, values_from=weight)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 5 x 5\n pig feed1 feed2 feed3 feed4\n \n1 1 60.8 68.7 92.6 87.9\n2 2 57 67.7 92.1 84.2\n3 3 65 74 90.2 83.1\n4 4 58.6 66.3 96.5 85.7\n5 5 61.7 69.8 99.1 90.3\n```\n\n\n:::\n:::\n\n\n\n\nwe are back where we started.\n\n## Make wider 2/2\n\nOr\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n pivot_wider(names_from=pig, values_from=weight)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 6\n feed `1` `2` `3` `4` `5`\n \n1 feed1 60.8 57 65 58.6 61.7\n2 feed2 68.7 67.7 74 66.3 69.8\n3 feed3 92.6 92.1 90.2 96.5 99.1\n4 feed4 87.9 84.2 83.1 85.7 90.3\n```\n\n\n:::\n:::\n\n\n\n\n## Disease presence and absence at two locations\n\nFrequencies of plants observed with and without disease at two\nlocations:\n\n``` \nSpecies Disease present Disease absent\n Location X Location Y Location X Location Y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nThis has two rows of headers, so I rewrote the data file:\n\n``` \nSpecies present_x present_y absent_x absent_y\nA 44 12 38 10\nB 28 22 20 18\n```\n\nRead into data frame called `prevalence`.\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/disease.txt\"\nprevalence <- read_table(my_url)\nprevalence\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n Species present_x present_y absent_x absent_y\n \n1 A 44 12 38 10\n2 B 28 22 20 18\n```\n\n\n:::\n:::\n\n\n\n\n## Lengthen and separate\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to = \"column\", \n values_to = \"freq\") %>% \n separate_wider_delim(column, \"_\", \n names = c(\"disease\", \"location\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 4\n Species disease location freq\n \n1 A present x 44\n2 A present y 12\n3 A absent x 38\n4 A absent y 10\n5 B present x 28\n6 B present y 22\n7 B absent x 20\n8 B absent y 18\n```\n\n\n:::\n:::\n\n\n\n\n## Making longer, the better way\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n Species present_x present_y absent_x absent_y\n \n1 A 44 12 38 10\n2 B 28 22 20 18\n```\n\n\n:::\n\n```{.r .cell-code}\nprevalence %>% \n pivot_longer(-Species, names_to=c(\"disease\", \"location\"),\n names_sep=\"_\", \n values_to=\"frequency\") -> prevalence_longer \nprevalence_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 4\n Species disease location frequency\n \n1 A present x 44\n2 A present y 12\n3 A absent x 38\n4 A absent y 10\n5 B present x 28\n6 B present y 22\n7 B absent x 20\n8 B absent y 18\n```\n\n\n:::\n:::\n\n\n\n\n## Making wider, different ways\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=c(Species, location), values_from=frequency)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n disease A_x A_y B_x B_y\n \n1 present 44 12 28 22\n2 absent 38 10 20 18\n```\n\n\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nprevalence_longer %>% \n pivot_wider(names_from=location, values_from=frequency)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 4\n Species disease x y\n \n1 A present 44 12\n2 A absent 38 10\n3 B present 28 22\n4 B absent 20 18\n```\n\n\n:::\n:::\n\n\n\n\n## Interlude {.smaller}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 20 x 3\n pig feed weight\n \n 1 1 feed1 60.8\n 2 1 feed2 68.7\n 3 1 feed3 92.6\n 4 1 feed4 87.9\n 5 2 feed1 57 \n 6 2 feed2 67.7\n 7 2 feed3 92.1\n 8 2 feed4 84.2\n 9 3 feed1 65 \n10 3 feed2 74 \n11 3 feed3 90.2\n12 3 feed4 83.1\n13 4 feed1 58.6\n14 4 feed2 66.3\n15 4 feed3 96.5\n16 4 feed4 85.7\n17 5 feed1 61.7\n18 5 feed2 69.8\n19 5 feed3 99.1\n20 5 feed4 90.3\n```\n\n\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(weight_mean=mean(weight))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 2\n feed weight_mean\n \n1 feed1 60.6\n2 feed2 69.3\n3 feed3 94.1\n4 feed4 86.2\n```\n\n\n:::\n:::\n\n\n\n\n## What if summary is more than one number?\n\neg. quartiles:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n# Groups: feed [4]\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## Following the hint...\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n reframe(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## this also works\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=quantile(weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n# Groups: feed [4]\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(quantile(weight, c(0.25, 0.75)))) %>% \n unnest(r)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 8 x 2\n feed r\n \n1 feed1 58.6\n2 feed1 61.7\n3 feed2 67.7\n4 feed2 69.8\n5 feed3 92.1\n6 feed3 96.5\n7 feed4 84.2\n8 feed4 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## or, even better, use `enframe`:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nquantile(pigs_longer$weight, c(0.25, 0.75))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n 25% 75% \n65.975 90.225 \n```\n\n\n:::\n\n```{.r .cell-code}\nenframe(quantile(pigs_longer$weight, c(0.25, 0.75)))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 2\n name value\n \n1 25% 66.0\n2 75% 90.2\n```\n\n\n:::\n:::\n\n\n\n\n## A nice look\n\nRun this one line at a time to see how it works:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\npigs_longer %>% \n group_by(feed) %>% \n summarize(r=list(enframe(quantile(weight, c(0.25, 0.75))))) %>% \n unnest(r) %>% \n pivot_wider(names_from=name, values_from=value) -> d\nd\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 4 x 3\n feed `25%` `75%`\n \n1 feed1 58.6 61.7\n2 feed2 67.7 69.8\n3 feed3 92.1 96.5\n4 feed4 84.2 87.9\n```\n\n\n:::\n:::\n\n\n\n\n## A hairy one\n\n18 people receive one of three treatments. At 3 different times (pre,\npost, followup) two variables `y` and `z` are measured on each person:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \"http://ritsokiguess.site/STAC32/repmes.txt\"\nrepmes0 <- read_table(my_url)\nrepmes0\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 18 x 8\n treatment rep pre_y post_y fu_y pre_z post_z fu_z\n \n 1 A 1 3 13 9 0 0 9\n 2 A 2 0 14 10 6 6 3\n 3 A 3 4 6 17 8 2 6\n 4 A 4 7 7 13 7 6 4\n 5 A 5 3 12 11 6 12 6\n 6 A 6 10 14 8 13 3 8\n 7 B 1 9 11 17 8 11 27\n 8 B 2 4 16 13 9 3 26\n 9 B 3 8 10 9 12 0 18\n10 B 4 5 9 13 3 0 14\n11 B 5 0 15 11 3 0 25\n12 B 6 4 11 14 4 2 9\n13 Control 1 10 12 15 4 3 7\n14 Control 2 2 8 12 8 7 20\n15 Control 3 4 9 10 2 0 10\n16 Control 4 10 8 8 5 8 14\n17 Control 5 11 11 11 1 0 11\n18 Control 6 1 5 15 8 9 10\n```\n\n\n:::\n\n```{.r .cell-code}\nrepmes0 %>% mutate(id=str_c(treatment, \".\", rep)) %>% \n select(-rep) %>% \n select(id, everything()) -> repmes\nrepmes\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 18 x 8\n id treatment pre_y post_y fu_y pre_z post_z fu_z\n \n 1 A.1 A 3 13 9 0 0 9\n 2 A.2 A 0 14 10 6 6 3\n 3 A.3 A 4 6 17 8 2 6\n 4 A.4 A 7 7 13 7 6 4\n 5 A.5 A 3 12 11 6 12 6\n 6 A.6 A 10 14 8 13 3 8\n 7 B.1 B 9 11 17 8 11 27\n 8 B.2 B 4 16 13 9 3 26\n 9 B.3 B 8 10 9 12 0 18\n10 B.4 B 5 9 13 3 0 14\n11 B.5 B 0 15 11 3 0 25\n12 B.6 B 4 11 14 4 2 9\n13 Control.1 Control 10 12 15 4 3 7\n14 Control.2 Control 2 8 12 8 7 20\n15 Control.3 Control 4 9 10 2 0 10\n16 Control.4 Control 10 8 8 5 8 14\n17 Control.5 Control 11 11 11 1 0 11\n18 Control.6 Control 1 5 15 8 9 10\n```\n\n\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) \n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 54 x 5\n id treatment time y z\n \n 1 A.1 A pre 3 0\n 2 A.1 A post 13 0\n 3 A.1 A fu 9 9\n 4 A.2 A pre 0 6\n 5 A.2 A post 14 6\n 6 A.2 A fu 10 3\n 7 A.3 A pre 4 8\n 8 A.3 A post 6 2\n 9 A.3 A fu 17 6\n10 A.4 A pre 7 7\n# i 44 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Attempt 1\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \"var\"),\n names_sep=\"_\",\n values_to = \"vvv\"\n )\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 108 x 5\n id treatment time var vvv\n \n 1 A.1 A pre y 3\n 2 A.1 A post y 13\n 3 A.1 A fu y 9\n 4 A.1 A pre z 0\n 5 A.1 A post z 0\n 6 A.1 A fu z 9\n 7 A.2 A pre y 0\n 8 A.2 A post y 14\n 9 A.2 A fu y 10\n10 A.2 A pre z 6\n# i 98 more rows\n```\n\n\n:::\n:::\n\n\n\n\nThis is *too* long! We wanted a column called `y` and a column called\n`z`, but they have been pivoted-longer too.\n\n## Attempt 2\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 18 x 8\n id treatment pre_y post_y fu_y pre_z post_z fu_z\n \n 1 A.1 A 3 13 9 0 0 9\n 2 A.2 A 0 14 10 6 6 3\n 3 A.3 A 4 6 17 8 2 6\n 4 A.4 A 7 7 13 7 6 4\n 5 A.5 A 3 12 11 6 12 6\n 6 A.6 A 10 14 8 13 3 8\n 7 B.1 B 9 11 17 8 11 27\n 8 B.2 B 4 16 13 9 3 26\n 9 B.3 B 8 10 9 12 0 18\n10 B.4 B 5 9 13 3 0 14\n11 B.5 B 0 15 11 3 0 25\n12 B.6 B 4 11 14 4 2 9\n13 Control.1 Control 10 12 15 4 3 7\n14 Control.2 Control 2 8 12 8 7 20\n15 Control.3 Control 4 9 10 2 0 10\n16 Control.4 Control 10 8 8 5 8 14\n17 Control.5 Control 11 11 11 1 0 11\n18 Control.6 Control 1 5 15 8 9 10\n```\n\n\n:::\n\n```{.r .cell-code}\nrepmes %>% pivot_longer(contains(\"_\"),\n names_to=c(\"time\", \".value\"),\n names_sep=\"_\"\n ) -> repmes3\nrepmes3\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 54 x 5\n id treatment time y z\n \n 1 A.1 A pre 3 0\n 2 A.1 A post 13 0\n 3 A.1 A fu 9 9\n 4 A.2 A pre 0 6\n 5 A.2 A post 14 6\n 6 A.2 A fu 10 3\n 7 A.3 A pre 4 8\n 8 A.3 A post 6 2\n 9 A.3 A fu 17 6\n10 A.4 A pre 7 7\n# i 44 more rows\n```\n\n\n:::\n:::\n\n\n\n\nThis has done what we wanted.\n\n## make a graph\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(repmes3, aes(x=fct_inorder(time), y=y, \n colour=treatment, group = id)) +\n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-beamer/tidy-extra-R-19-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nA so-called spaghetti plot. The three measurements for each person are\njoined by lines, and the lines are coloured by treatment.\n\n## or do the plot with means\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nrepmes3 %>% group_by(treatment, ftime=fct_inorder(time)) %>% \n summarize(mean_y=mean(y)) %>% \n ggplot(aes(x=ftime, y=mean_y, colour=treatment, \n group=treatment)) + \n geom_point() + geom_line()\n```\n\n::: {.cell-output-display}\n![](tidy_extra_files/figure-beamer/tidy-extra-R-20-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nOn average, the two real treatments go up and level off, but the control\ngroup is very different.\n", "supporting": [ "tidy_extra_files/figure-beamer" ], diff --git a/_freeze/tidy_extra/figure-beamer/tidy-extra-R-19-1.pdf b/_freeze/tidy_extra/figure-beamer/tidy-extra-R-19-1.pdf index 85880dd832cc965af6b58b45d39c52425d4ab6cb..a8cbd5112bc381256d8c25a0b0dd46468f7a0451 100644 GIT binary patch delta 52 zcmZ2zy3lljxr(8Yp@Fffsi7v9zHfetOJYf?f`*Hgk%5tkp&?9eVzeHk(Z()uDFAQ5 B4P^iT delta 52 zcmZ2zy3lljxr%|gp|O#Xk)^U B4lDow delta 52 zcmX@4bx3Q1xr%|gp|O#Xk)}U B4m$t< diff --git a/_freeze/windmill/execute-results/html.json b/_freeze/windmill/execute-results/html.json index e81f0d0..ff4abd9 100644 --- a/_freeze/windmill/execute-results/html.json +++ b/_freeze/windmill/execute-results/html.json @@ -1,8 +1,8 @@ { - "hash": "f297aef6d4ce2415f1efd9c1e80aa4d5", + "hash": "f5ed2125da74e663399b3e08ed351687", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Case study: windmill\"\neditor: \n markdown: \n wrap: 72\n---\n\n\n## The windmill data\n\n- Engineer: does amount of electricity generated by windmill depend on\n how strongly wind blowing?\n- Measurements of wind speed and DC current generated at various\n times.\n- Assume the \"various times\" to be randomly selected --- aim to\n generalize to \"this windmill at all times\".\n- Research questions:\n - Relationship between wind speed and current generated?\n - If so, what kind of relationship?\n - Can we model relationship to do predictions?\n\n## Packages for this section\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\nlibrary(broom)\n```\n:::\n\n\n## Reading in the data\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \n \"http://ritsokiguess.site/datafiles/windmill.csv\"\nwindmill <- read_csv(my_url)\nwindmill\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Strategy\n\n- Two quantitative variables, looking for relationship: regression\n methods.\n- Start with picture (scatterplot).\n- Fit models and do model checking, fixing up things as necessary.\n- Scatterplot:\n - 2 variables, `DC_output` and `wind_velocity`.\n - First is output/response, other is input/explanatory.\n - Put `DC_output` on vertical scale.\n- Add trend, but don't want to assume linear:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth() \n```\n:::\n\n\n## Scatterplot\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-5-1.png){width=960}\n:::\n:::\n\n\n## Comments\n\n- Definitely a relationship: as wind velocity increases, so does DC\n output. (As you'd expect.)\n- Is relationship linear? To help judge, `geom_smooth` smooths\n scatterplot trend. (Trend called \"loess\", \"Locally weighted least\n squares\" which downweights outliers. Not constrained to be\n straight.)\n- Trend more or less linear for while, then curves downwards\n (levelling off?). Straight line not so good here.\n\n## Fit a straight line (and see what happens)\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.1 <- lm(DC_output ~ wind_velocity, data = windmill)\nsummary(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.59869 -0.14099 0.06059 0.17262 0.32184 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 0.13088 0.12599 1.039 0.31 \nwind_velocity 0.24115 0.01905 12.659 7.55e-12 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.2361 on 23 degrees of freedom\nMultiple R-squared: 0.8745,\tAdjusted R-squared: 0.869 \nF-statistic: 160.3 on 1 and 23 DF, p-value: 7.546e-12\n```\n\n\n:::\n:::\n\n\n## Another way of looking at the output\n\n- The standard output tends to go off the bottom of the page rather\n easily. Package `broom` has these:\n\n\\scriptsize\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.1)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\\normalsize\n\nshowing that the R-squared is 87%, and\n\n\\footnotesize\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.1)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\\normalsize\n\nshowing the intercept and slope and their significance.\n\n## Comments\n\n- Strategy: `lm` actually fits the regression. Store results in a\n variable. Then look at the results, eg. via `summary` or\n `glance`/`tidy`.\n- My strategy for model names: base on response variable (or data\n frame name) and a number. Allows me to fit several models to same\n data and keep track of which is which.\n- Results actually pretty good: `wind.velocity` strongly significant,\n R-squared (87%) high.\n- How to check whether regression is appropriate? Look at the\n residuals, observed minus predicted, plotted against fitted\n (predicted).\n- Plot using the regression object as \"data frame\" (in a couple of\n slides).\n\n## Scatterplot, but with line\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method=\"lm\", se = FALSE)\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-11-1.png){width=960}\n:::\n:::\n\n\n## Plot of residuals against fitted values\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-13-1.png){width=960}\n:::\n:::\n\n\n## Comments on residual plot\n\n- Residual plot should be a random scatter of points.\n- Should be no pattern \"left over\" after fitting the regression.\n- Smooth trend should be more or less straight across at 0.\n- Here, have a curved trend on residual plot.\n- This means original relationship must have been a curve (as we saw\n on original scatterplot).\n- Possible ways to fit a curve:\n - Add a squared term in explanatory variable.\n - Transform response variable (doesn't work well here).\n - See what science tells you about mathematical form of\n relationship, and try to apply.\n\n## normal quantile plot of residuals\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-1-1.png){width=960}\n:::\n:::\n\n\n## Parabolas and fitting parabola model\n\n- A parabola has equation $$y = ax^2 + bx + c$$ with coefficients\n $a, b, c$. About the simplest function that is not a straight line.\n- Fit one using `lm` by adding $x^2$ to right side of model formula\n with +:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.2 <- lm(DC_output ~ wind_velocity + I(wind_velocity^2),\n data = windmill\n)\n```\n:::\n\n\n- The `I()` necessary because `^` in model formula otherwise means\n something different (to do with interactions in ANOVA).\n- Call it *parabola model*.\n\n## Parabola model output\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n\n```{.r .cell-code}\n# tidy(DC.2)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\\scriptsize\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.2)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\\normalsize\n\n## Comments on output\n\n- R-squared has gone up a lot, from 87% (line) to 97% (parabola).\n- Coefficient of squared term strongly significant (P-value\n $6.59 \\times 10^{−8}$).\n- Adding squared term has definitely improved fit of model.\n- Parabola model better than linear one.\n- But...need to check residuals again.\n\n## Residual plot from parabola model\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(y = .resid, x = .fitted)) +\n geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-18-1.png){width=960}\n:::\n:::\n\n\n## normal quantile plot of residuals\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-3-1.png){width=960}\n:::\n:::\n\n\nThis distribution has long tails, which should worry us at least some.\n\n## Make scatterplot with fitted line and curve\n\n- Residual plot basically random. Good.\n- Scatterplot with fitted line and curve like this:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method = \"lm\", se = F) +\n geom_line(data = DC.2, aes(y = .fitted))\n```\n:::\n\n\n## Comments\n\n- This plots:\n - scatterplot (`geom_point`);\n - straight line (via tweak to `geom_smooth`, which draws\n best-fitting line);\n - fitted curve, using the predicted `DC_output` values, joined by\n lines (with points not shown).\n- Trick in the `geom_line` is use the predictions as the `y`-points to\n join by lines (from `DC.2`), instead of the original data points.\n Without the `data` and `aes` in the `geom_line`, original data\n points would be joined by lines.\n\n## Scatterplot with fitted line and curve\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-19-1.png){width=960}\n:::\n:::\n\n\nCurve clearly fits better than line.\n\n## Another approach to a curve\n\n- There is a problem with parabolas, which we'll see later.\n\n- Ask engineer, \"what should happen as wind velocity increases?\":\n\n - Upper limit on electricity generated, but otherwise, the larger\n the wind velocity, the more electricity generated.\n\n- Mathematically, *asymptote*. Straight lines and parabolas don't have\n them, but eg. $y = 1/x$ does: as $x$ gets bigger, $y$ approaches\n zero without reaching it.\n\n- What happens to $y = a + b(1/x)$ as $x$ gets large?\n\n - $y$ gets closer and closer to $a$: that is, $a$ is asymptote.\n\n- Fit this, call it asymptote model.\n\n- Fitting the model here because we have math to justify it.\n\n - Alternative, $y = a + be^{−x}$ , approaches asymptote faster.\n\n## How to fit asymptote model?\n\n- Define new explanatory variable to be $1/x$, and predict $y$ from\n it.\n- $x$ is velocity, distance over time.\n- So $1/x$ is time over distance. In walking world, if you walk 5\n km/h, take 12 minutes to walk 1 km, called your pace. So 1 over\n `wind_velocity` we call `wind_pace`.\n- Make a scatterplot first to check for straightness (next page).\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwindmill %>% mutate(wind_pace = 1 / wind_velocity) -> windmill\nggplot(windmill, aes(y = DC_output, x = wind_pace)) +\n geom_point() + geom_smooth(se = F)\n```\n:::\n\n\n- and run regression like this (output page after):\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.3 <- lm(DC_output ~ wind_pace, data = windmill)\nsummary(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_pace, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.20547 -0.04940 0.01100 0.08352 0.12204 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 2.9789 0.0449 66.34 <2e-16 ***\nwind_pace -6.9345 0.2064 -33.59 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.09417 on 23 degrees of freedom\nMultiple R-squared: 0.98,\tAdjusted R-squared: 0.9792 \nF-statistic: 1128 on 1 and 23 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n## Scatterplot for wind_pace\n\nPretty straight. Blue actually smooth curve not line:\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-20-1.png){width=960}\n:::\n:::\n\n\n## Regression output\n\n\\scriptsize\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\\normalsize\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Comments\n\n- R-squared, 98%, even higher than for parabola model (97%).\n- Simpler model, only one explanatory variable (`wind.pace`) vs. 2 for\n parabola model (`wind.velocity` and its square).\n- `wind.pace` (unsurprisingly) strongly significant.\n- Looks good, but check residual plot (over).\n\n## Residual plot for asymptote model\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/resida-1.png){width=960}\n:::\n:::\n\n\n## normal quantile plot of residuals\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-4-1.png){width=960}\n:::\n:::\n\n\nThis is skewed (left), but is not bad (and definitely better than the\none for the parabola model).\n\n## Plotting trends on scatterplot\n\n- Residual plot not bad. But residuals go up to 0.10 and down to\n −0.20, suggesting possible skewness (not normal). I think it's not\n perfect, but OK overall.\n- Next: plot scatterplot with all three fitted lines/curves on it (for\n comparison), with legend saying which is which.\n- First make data frame containing what we need, taken from the right\n places:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 <- tibble(\n wind_velocity = windmill$wind_velocity,\n DC_output = windmill$DC_output,\n linear = fitted(DC.1),\n parabola = fitted(DC.2),\n asymptote = fitted(DC.3)\n)\n```\n:::\n\n\n## What's in `w2`\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Making the plot\n\n- `ggplot` likes to have one column of $x$'s to plot, and one column\n of $y$'s, with another column for distinguishing things.\n- But we have three columns of fitted values, that need to be combined\n into one.\n- `pivot_longer`, then plot:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 %>%\n pivot_longer(linear:asymptote, names_to=\"model\", \n values_to=\"fit\") %>%\n ggplot(aes(x = wind_velocity, y = DC_output)) +\n geom_point() +\n geom_line(aes(y = fit, colour = model)) \n```\n:::\n\n\n## Scatterplot with fitted curves\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-25-1.png){width=960}\n:::\n:::\n\n\n## Comments\n\n- Predictions from curves are very similar.\n- Predictions from asymptote model as good, and from simpler model\n (one $x$ not two), so prefer those.\n- Go back to asymptote model summary.\n\n## Asymptote model summary\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Comments\n\n- Intercept in this model about 3.\n- Intercept of asymptote model is the asymptote (upper limit of\n `DC.output`).\n- Not close to asymptote yet.\n- Therefore, from this model, wind could get stronger and would\n generate appreciably more electricity.\n- This is extrapolation! Would like more data from times when\n `wind.velocity` higher.\n- Slope −7. Why negative?\n - As wind.velocity increases, wind.pace goes down, and DC.output\n goes up. Check.\n- Actual slope number hard to interpret.\n\n## Checking back in with research questions\n\n- Is there a relationship between wind speed and current generated?\n - Yes.\n- If so, what kind of relationship is it?\n - One with an asymptote.\n- Can we model the relationship, in such a way that we can do\n predictions?\n - Yes, see model DC.3 and plot of fitted curve.\n- Good. Job done.\n\n## Job done, kinda\n\n- Just because the parabola model and asymptote model agree over the\n range of the data, doesn't necessarily mean they agree everywhere.\n- Extend range of wind.velocity to 1 to 16 (steps of 0.5), and predict\n DC.output according to the two models:\n\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nwv <- seq(1, 16, 0.5)\nwv\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0\n[14] 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5\n[27] 14.0 14.5 15.0 15.5 16.0\n```\n\n\n:::\n:::\n\n\n- R has `predict`, which requires what to predict for, as data frame.\n The data frame has to contain values, with matching names, for all\n explanatory variables in regression(s).\n\n## Setting up data frame to predict from\n\n- Linear model had just `wind_velocity`.\n- Parabola model had that as well (squared one will be calculated)\n- Asymptote model had just `wind_pace` (reciprocal of velocity).\n- So create data frame called `wv_new` with those in:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new <- tibble(wind_velocity = wv, wind_pace = 1 / wv)\n```\n:::\n\n\n## `wv_new`\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Doing predictions, one for each model\n\n- Use same names as before:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlinear <- predict(DC.1, wv_new)\nparabola <- predict(DC.2, wv_new)\nasymptote <- predict(DC.3, wv_new)\n```\n:::\n\n\n- Put it all into a data frame for plotting, along with original data:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits <- tibble(\n wind_velocity = wv_new$wind_velocity,\n linear, parabola, asymptote\n)\n```\n:::\n\n\n## `my_fits`\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n## Making a plot 1/2\n\n- To make a plot, we use the same trick as last time to get all three\n predictions on a plot with a legend (saving result to add to later):\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits %>%\n pivot_longer(\n linear:asymptote,\n names_to=\"model\", \n values_to=\"fit\"\n ) %>%\n ggplot(aes(\n y = fit, x = wind_velocity,\n colour = model\n )) + geom_line() -> g\n```\n:::\n\n\n## Making a plot 2/2\n\n- The observed wind velocities were in this range:\n\n\n::: {.cell}\n\n```{.r .cell-code}\n(vels <- range(windmill$wind_velocity))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2.45 10.20\n```\n\n\n:::\n:::\n\n\n- `DC.output` between 0 and 3 from asymptote model. Add rectangle to\n graph around where the data were:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ng + geom_rect(\n xmin = vels[1], xmax = vels[2], ymin = 0, ymax = 3,\n alpha=0, colour = \"black\"\n)\n```\n:::\n\n\n## The plot\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-35-1.png){width=960}\n:::\n:::\n\n\n## Comments (1)\n\n- Over range of data, two models agree with each other well.\n- Outside range of data, they disagree violently!\n- For larger `wind.velocity`, asymptote model behaves reasonably,\n parabola model does not.\n- What happens as `wind.velocity` goes to zero? Should find\n `DC.output` goes to zero as well. Does it?\n\n## Comments (2)\n\n- For parabola model:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.2)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n- Nope, goes to −1.16 (intercept), actually significantly different\n from zero.\n\n## Comments (3): asymptote model\n\n\\small\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\\normalsize\n\n- As `wind.velocity` heads to 0, wind.pace heads to $+\\infty$, so\n DC.output heads to $−\\infty$!\n- Also need more data for small `wind.velocity` to understand\n relationship. (Is there a lower asymptote?)\n- Best we can do now is to predict `DC.output` to be zero for small\n `wind.velocity`.\n- Assumes a \"threshold\" wind velocity below which no electricity\n generated at all.\n\n## Summary\n\n- Often, in data analysis, there is no completely satisfactory\n conclusion, as here.\n- Have to settle for model that works OK, with restrictions.\n- Always something else you can try.\n- At some point you have to say \"I stop.\"\n", + "markdown": "---\ntitle: \"Case study: windmill\"\neditor: \n markdown: \n wrap: 72\n---\n\n\n\n\n## The windmill data\n\n- Engineer: does amount of electricity generated by windmill depend on\n how strongly wind blowing?\n- Measurements of wind speed and DC current generated at various\n times.\n- Assume the \"various times\" to be randomly selected --- aim to\n generalize to \"this windmill at all times\".\n- Research questions:\n - Relationship between wind speed and current generated?\n - If so, what kind of relationship?\n - Can we model relationship to do predictions?\n\n## Packages for this section\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\nlibrary(broom)\n```\n:::\n\n\n\n\n## Reading in the data\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \n \"http://ritsokiguess.site/datafiles/windmill.csv\"\nwindmill <- read_csv(my_url)\nwindmill\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Strategy\n\n- Two quantitative variables, looking for relationship: regression\n methods.\n- Start with picture (scatterplot).\n- Fit models and do model checking, fixing up things as necessary.\n- Scatterplot:\n - 2 variables, `DC_output` and `wind_velocity`.\n - First is output/response, other is input/explanatory.\n - Put `DC_output` on vertical scale.\n- Add trend, but don't want to assume linear:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth() \n```\n:::\n\n\n\n\n## Scatterplot\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-5-1.png){width=960}\n:::\n:::\n\n\n\n\n## Comments\n\n- Definitely a relationship: as wind velocity increases, so does DC\n output. (As you'd expect.)\n- Is relationship linear? To help judge, `geom_smooth` smooths\n scatterplot trend. (Trend called \"loess\", \"Locally weighted least\n squares\" which downweights outliers. Not constrained to be\n straight.)\n- Trend more or less linear for while, then curves downwards\n (levelling off?). Straight line not so good here.\n\n## Fit a straight line (and see what happens)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.1 <- lm(DC_output ~ wind_velocity, data = windmill)\nsummary(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.59869 -0.14099 0.06059 0.17262 0.32184 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 0.13088 0.12599 1.039 0.31 \nwind_velocity 0.24115 0.01905 12.659 7.55e-12 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.2361 on 23 degrees of freedom\nMultiple R-squared: 0.8745,\tAdjusted R-squared: 0.869 \nF-statistic: 160.3 on 1 and 23 DF, p-value: 7.546e-12\n```\n\n\n:::\n:::\n\n\n\n\n## Another way of looking at the output\n\n- The standard output tends to go off the bottom of the page rather\n easily. Package `broom` has these:\n\n\\scriptsize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.1)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n\\normalsize\n\nshowing that the R-squared is 87%, and\n\n\\footnotesize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.1)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n\\normalsize\n\nshowing the intercept and slope and their significance.\n\n## Comments\n\n- Strategy: `lm` actually fits the regression. Store results in a\n variable. Then look at the results, eg. via `summary` or\n `glance`/`tidy`.\n- My strategy for model names: base on response variable (or data\n frame name) and a number. Allows me to fit several models to same\n data and keep track of which is which.\n- Results actually pretty good: `wind.velocity` strongly significant,\n R-squared (87%) high.\n- How to check whether regression is appropriate? Look at the\n residuals, observed minus predicted, plotted against fitted\n (predicted).\n- Plot using the regression object as \"data frame\" (in a couple of\n slides).\n\n## Scatterplot, but with line\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method=\"lm\", se = FALSE)\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-11-1.png){width=960}\n:::\n:::\n\n\n\n\n## Plot of residuals against fitted values\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-13-1.png){width=960}\n:::\n:::\n\n\n\n\n## Comments on residual plot\n\n- Residual plot should be a random scatter of points.\n- Should be no pattern \"left over\" after fitting the regression.\n- Smooth trend should be more or less straight across at 0.\n- Here, have a curved trend on residual plot.\n- This means original relationship must have been a curve (as we saw\n on original scatterplot).\n- Possible ways to fit a curve:\n - Add a squared term in explanatory variable.\n - Transform response variable (doesn't work well here).\n - See what science tells you about mathematical form of\n relationship, and try to apply.\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-1-1.png){width=960}\n:::\n:::\n\n\n\n\n## Parabolas and fitting parabola model\n\n- A parabola has equation $$y = ax^2 + bx + c$$ with coefficients\n $a, b, c$. About the simplest function that is not a straight line.\n- Fit one using `lm` by adding $x^2$ to right side of model formula\n with +:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.2 <- lm(DC_output ~ wind_velocity + I(wind_velocity^2),\n data = windmill\n)\n```\n:::\n\n\n\n\n- The `I()` necessary because `^` in model formula otherwise means\n something different (to do with interactions in ANOVA).\n- Call it *parabola model*.\n\n## Parabola model output\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n\n```{.r .cell-code}\n# tidy(DC.2)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n\n\\scriptsize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.2)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n\\normalsize\n\n## Comments on output\n\n- R-squared has gone up a lot, from 87% (line) to 97% (parabola).\n- Coefficient of squared term strongly significant (P-value\n $6.59 \\times 10^{−8}$).\n- Adding squared term has definitely improved fit of model.\n- Parabola model better than linear one.\n- But...need to check residuals again.\n\n## Residual plot from parabola model\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(y = .resid, x = .fitted)) +\n geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-18-1.png){width=960}\n:::\n:::\n\n\n\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-3-1.png){width=960}\n:::\n:::\n\n\n\n\nThis distribution has long tails, which should worry us at least some.\n\n## Make scatterplot with fitted line and curve\n\n- Residual plot basically random. Good.\n- Scatterplot with fitted line and curve like this:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method = \"lm\", se = F) +\n geom_line(data = DC.2, aes(y = .fitted))\n```\n:::\n\n\n\n\n## Comments\n\n- This plots:\n - scatterplot (`geom_point`);\n - straight line (via tweak to `geom_smooth`, which draws\n best-fitting line);\n - fitted curve, using the predicted `DC_output` values, joined by\n lines (with points not shown).\n- Trick in the `geom_line` is use the predictions as the `y`-points to\n join by lines (from `DC.2`), instead of the original data points.\n Without the `data` and `aes` in the `geom_line`, original data\n points would be joined by lines.\n\n## Scatterplot with fitted line and curve\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-19-1.png){width=960}\n:::\n:::\n\n\n\n\nCurve clearly fits better than line.\n\n## Another approach to a curve\n\n- There is a problem with parabolas, which we'll see later.\n\n- Ask engineer, \"what should happen as wind velocity increases?\":\n\n - Upper limit on electricity generated, but otherwise, the larger\n the wind velocity, the more electricity generated.\n\n- Mathematically, *asymptote*. Straight lines and parabolas don't have\n them, but eg. $y = 1/x$ does: as $x$ gets bigger, $y$ approaches\n zero without reaching it.\n\n- What happens to $y = a + b(1/x)$ as $x$ gets large?\n\n - $y$ gets closer and closer to $a$: that is, $a$ is asymptote.\n\n- Fit this, call it asymptote model.\n\n- Fitting the model here because we have math to justify it.\n\n - Alternative, $y = a + be^{−x}$ , approaches asymptote faster.\n\n## How to fit asymptote model?\n\n- Define new explanatory variable to be $1/x$, and predict $y$ from\n it.\n- $x$ is velocity, distance over time.\n- So $1/x$ is time over distance. In walking world, if you walk 5\n km/h, take 12 minutes to walk 1 km, called your pace. So 1 over\n `wind_velocity` we call `wind_pace`.\n- Make a scatterplot first to check for straightness (next page).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwindmill %>% mutate(wind_pace = 1 / wind_velocity) -> windmill\nggplot(windmill, aes(y = DC_output, x = wind_pace)) +\n geom_point() + geom_smooth(se = F)\n```\n:::\n\n\n\n\n## and run regression like this:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.3 <- lm(DC_output ~ wind_pace, data = windmill)\nsummary(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_pace, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.20547 -0.04940 0.01100 0.08352 0.12204 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 2.9789 0.0449 66.34 <2e-16 ***\nwind_pace -6.9345 0.2064 -33.59 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.09417 on 23 degrees of freedom\nMultiple R-squared: 0.98,\tAdjusted R-squared: 0.9792 \nF-statistic: 1128 on 1 and 23 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n\n## Scatterplot for wind_pace\n\nPretty straight. Blue actually smooth curve not line:\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-20-1.png){width=960}\n:::\n:::\n\n\n\n\n## Regression output\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Comments\n\n- R-squared, 98%, even higher than for parabola model (97%).\n- Simpler model, only one explanatory variable (`wind.pace`) vs. 2 for\n parabola model (`wind.velocity` and its square).\n- `wind.pace` (unsurprisingly) strongly significant.\n- Looks good, but check residual plot (over).\n\n## Residual plot for asymptote model\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/resida-1.png){width=960}\n:::\n:::\n\n\n\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/unnamed-chunk-4-1.png){width=960}\n:::\n:::\n\n\n\n\nThis is skewed (left), but is not bad (and definitely better than the\none for the parabola model).\n\n## Plotting trends on scatterplot\n\n- Residual plot not bad. But residuals go up to 0.10 and down to\n −0.20, suggesting possible skewness (not normal). I think it's not\n perfect, but OK overall.\n- Next: plot scatterplot with all three fitted lines/curves on it (for\n comparison), with legend saying which is which.\n- First make data frame containing what we need, taken from the right\n places:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 <- tibble(\n wind_velocity = windmill$wind_velocity,\n DC_output = windmill$DC_output,\n linear = fitted(DC.1),\n parabola = fitted(DC.2),\n asymptote = fitted(DC.3)\n)\n```\n:::\n\n\n\n\n## What's in `w2`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making the plot\n\n- `ggplot` likes to have one column of $x$'s to plot, and one column\n of $y$'s, with another column for distinguishing things.\n- But we have three columns of fitted values, that need to be combined\n into one.\n- `pivot_longer`, then plot:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 %>%\n pivot_longer(linear:asymptote, names_to=\"model\", \n values_to=\"fit\") %>%\n ggplot(aes(x = wind_velocity, y = DC_output)) +\n geom_point() +\n geom_line(aes(y = fit, colour = model)) \n```\n:::\n\n\n\n\n## Scatterplot with fitted curves\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-25-1.png){width=960}\n:::\n:::\n\n\n\n\n## Comments\n\n- Predictions from curves are very similar.\n- Predictions from asymptote model as good, and from simpler model\n (one $x$ not two), so prefer those.\n- Go back to asymptote model summary.\n\n## Asymptote model summary\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Comments\n\n- Intercept in this model about 3.\n- Intercept of asymptote model is the asymptote (upper limit of\n `DC.output`).\n- Not close to asymptote yet.\n- Therefore, from this model, wind could get stronger and would\n generate appreciably more electricity.\n- This is extrapolation! Would like more data from times when\n `wind.velocity` higher.\n- Slope −7. Why negative?\n - As wind.velocity increases, wind.pace goes down, and DC.output\n goes up. Check.\n- Actual slope number hard to interpret.\n\n## Checking back in with research questions\n\n- Is there a relationship between wind speed and current generated?\n - Yes.\n- If so, what kind of relationship is it?\n - One with an asymptote.\n- Can we model the relationship, in such a way that we can do\n predictions?\n - Yes, see model DC.3 and plot of fitted curve.\n- Good. Job done.\n\n## Job done, kinda\n\n- Just because the parabola model and asymptote model agree over the\n range of the data, doesn't necessarily mean they agree everywhere.\n- Extend range of wind.velocity to 1 to 16 (steps of 0.5), and predict\n DC.output according to the two models:\n\n\n\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nwv <- seq(1, 16, 0.5)\nwv\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0\n[14] 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5\n[27] 14.0 14.5 15.0 15.5 16.0\n```\n\n\n:::\n:::\n\n\n\n\n- R has `predict`, which requires what to predict for, as data frame.\n The data frame has to contain values, with matching names, for all\n explanatory variables in regression(s).\n\n## Setting up data frame to predict from\n\n- Linear model had just `wind_velocity`.\n- Parabola model had that as well (squared one will be calculated)\n- Asymptote model had just `wind_pace` (reciprocal of velocity).\n- So create data frame called `wv_new` with those in:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new <- tibble(wind_velocity = wv, wind_pace = 1 / wv)\n```\n:::\n\n\n\n\n## `wv_new`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Doing predictions, one for each model\n\n- Use same names as before:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlinear <- predict(DC.1, wv_new)\nparabola <- predict(DC.2, wv_new)\nasymptote <- predict(DC.3, wv_new)\n```\n:::\n\n\n\n\n- Put it all into a data frame for plotting, along with original data:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits <- tibble(\n wind_velocity = wv_new$wind_velocity,\n linear, parabola, asymptote\n)\n```\n:::\n\n\n\n\n## `my_fits`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n## Making a plot 1/2\n\n- To make a plot, we use the same trick as last time to get all three\n predictions on a plot with a legend (saving result to add to later):\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits %>%\n pivot_longer(\n linear:asymptote,\n names_to=\"model\", \n values_to=\"fit\"\n ) %>%\n ggplot(aes(\n y = fit, x = wind_velocity,\n colour = model\n )) + geom_line() -> g\n```\n:::\n\n\n\n\n## Making a plot 2/2\n\n- The observed wind velocities were in this range:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n(vels <- range(windmill$wind_velocity))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2.45 10.20\n```\n\n\n:::\n:::\n\n\n\n\n- `DC.output` between 0 and 3 from asymptote model. Add rectangle to\n graph around where the data were:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ng + geom_rect(\n xmin = vels[1], xmax = vels[2], ymin = 0, ymax = 3,\n alpha=0, colour = \"black\"\n)\n```\n:::\n\n\n\n\n## The plot\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-revealjs/windmill-35-1.png){width=960}\n:::\n:::\n\n\n\n\n## Comments (1)\n\n- Over range of data, two models agree with each other well.\n- Outside range of data, they disagree violently!\n- For larger `wind.velocity`, asymptote model behaves reasonably,\n parabola model does not.\n- What happens as `wind.velocity` goes to zero? Should find\n `DC.output` goes to zero as well. Does it?\n\n## Comments (2)\n\n- For parabola model:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.2)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n- Nope, goes to −1.16 (intercept), actually significantly different\n from zero.\n\n## Comments (3): asymptote model\n\n\\small\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output-display}\n`````{=html}\n
\n \n
\n`````\n:::\n:::\n\n\n\n\n\\normalsize\n\n- As `wind.velocity` heads to 0, wind.pace heads to $+\\infty$, so\n DC.output heads to $−\\infty$!\n- Also need more data for small `wind.velocity` to understand\n relationship. (Is there a lower asymptote?)\n- Best we can do now is to predict `DC.output` to be zero for small\n `wind.velocity`.\n- Assumes a \"threshold\" wind velocity below which no electricity\n generated at all.\n\n## Summary\n\n- Often, in data analysis, there is no completely satisfactory\n conclusion, as here.\n- Have to settle for model that works OK, with restrictions.\n- Always something else you can try.\n- At some point you have to say \"I stop.\"\n", "supporting": [ "windmill_files" ], diff --git a/_freeze/windmill/execute-results/tex.json b/_freeze/windmill/execute-results/tex.json index ee4d120..b62b61f 100644 --- a/_freeze/windmill/execute-results/tex.json +++ b/_freeze/windmill/execute-results/tex.json @@ -1,8 +1,8 @@ { - "hash": "f297aef6d4ce2415f1efd9c1e80aa4d5", + "hash": "f5ed2125da74e663399b3e08ed351687", "result": { "engine": "knitr", - "markdown": "---\ntitle: \"Case study: windmill\"\neditor: \n markdown: \n wrap: 72\n---\n\n\n\n## The windmill data\n\n- Engineer: does amount of electricity generated by windmill depend on\n how strongly wind blowing?\n- Measurements of wind speed and DC current generated at various\n times.\n- Assume the \"various times\" to be randomly selected --- aim to\n generalize to \"this windmill at all times\".\n- Research questions:\n - Relationship between wind speed and current generated?\n - If so, what kind of relationship?\n - Can we model relationship to do predictions?\n\n## Packages for this section\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\nlibrary(broom)\n```\n:::\n\n\n\n## Reading in the data\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \n \"http://ritsokiguess.site/datafiles/windmill.csv\"\nwindmill <- read_csv(my_url)\nwindmill\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 25 x 2\n wind_velocity DC_output\n \n 1 5 1.58 \n 2 6 1.82 \n 3 3.4 1.06 \n 4 2.7 0.5 \n 5 10 2.24 \n 6 9.7 2.39 \n 7 9.55 2.29 \n 8 3.05 0.558\n 9 8.15 2.17 \n10 6.2 1.87 \n# i 15 more rows\n```\n\n\n:::\n:::\n\n\n\n## Strategy\n\n- Two quantitative variables, looking for relationship: regression\n methods.\n- Start with picture (scatterplot).\n- Fit models and do model checking, fixing up things as necessary.\n- Scatterplot:\n - 2 variables, `DC_output` and `wind_velocity`.\n - First is output/response, other is input/explanatory.\n - Put `DC_output` on vertical scale.\n- Add trend, but don't want to assume linear:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth() \n```\n:::\n\n\n\n## Scatterplot\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-5-1.pdf)\n:::\n:::\n\n\n\n## Comments\n\n- Definitely a relationship: as wind velocity increases, so does DC\n output. (As you'd expect.)\n- Is relationship linear? To help judge, `geom_smooth` smooths\n scatterplot trend. (Trend called \"loess\", \"Locally weighted least\n squares\" which downweights outliers. Not constrained to be\n straight.)\n- Trend more or less linear for while, then curves downwards\n (levelling off?). Straight line not so good here.\n\n## Fit a straight line (and see what happens)\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.1 <- lm(DC_output ~ wind_velocity, data = windmill)\nsummary(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.59869 -0.14099 0.06059 0.17262 0.32184 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 0.13088 0.12599 1.039 0.31 \nwind_velocity 0.24115 0.01905 12.659 7.55e-12 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.2361 on 23 degrees of freedom\nMultiple R-squared: 0.8745,\tAdjusted R-squared: 0.869 \nF-statistic: 160.3 on 1 and 23 DF, p-value: 7.546e-12\n```\n\n\n:::\n:::\n\n\n\n## Another way of looking at the output\n\n- The standard output tends to go off the bottom of the page rather\n easily. Package `broom` has these:\n\n\\scriptsize\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.874 0.869 0.236 160. 7.55e-12 1 1.66 2.68 6.33\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n\n\n\\normalsize\n\nshowing that the R-squared is 87%, and\n\n\\footnotesize\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 0.131 0.126 1.04 3.10e- 1\n2 wind_velocity 0.241 0.0190 12.7 7.55e-12\n```\n\n\n:::\n:::\n\n\n\n\\normalsize\n\nshowing the intercept and slope and their significance.\n\n## Comments\n\n- Strategy: `lm` actually fits the regression. Store results in a\n variable. Then look at the results, eg. via `summary` or\n `glance`/`tidy`.\n- My strategy for model names: base on response variable (or data\n frame name) and a number. Allows me to fit several models to same\n data and keep track of which is which.\n- Results actually pretty good: `wind.velocity` strongly significant,\n R-squared (87%) high.\n- How to check whether regression is appropriate? Look at the\n residuals, observed minus predicted, plotted against fitted\n (predicted).\n- Plot using the regression object as \"data frame\" (in a couple of\n slides).\n\n## Scatterplot, but with line\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method=\"lm\", se = FALSE)\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-11-1.pdf)\n:::\n:::\n\n\n\n## Plot of residuals against fitted values\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-13-1.pdf)\n:::\n:::\n\n\n\n## Comments on residual plot\n\n- Residual plot should be a random scatter of points.\n- Should be no pattern \"left over\" after fitting the regression.\n- Smooth trend should be more or less straight across at 0.\n- Here, have a curved trend on residual plot.\n- This means original relationship must have been a curve (as we saw\n on original scatterplot).\n- Possible ways to fit a curve:\n - Add a squared term in explanatory variable.\n - Transform response variable (doesn't work well here).\n - See what science tells you about mathematical form of\n relationship, and try to apply.\n\n## normal quantile plot of residuals\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-1-1.pdf)\n:::\n:::\n\n\n\n## Parabolas and fitting parabola model\n\n- A parabola has equation $$y = ax^2 + bx + c$$ with coefficients\n $a, b, c$. About the simplest function that is not a straight line.\n- Fit one using `lm` by adding $x^2$ to right side of model formula\n with +:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.2 <- lm(DC_output ~ wind_velocity + I(wind_velocity^2),\n data = windmill\n)\n```\n:::\n\n\n\n- The `I()` necessary because `^` in model formula otherwise means\n something different (to do with interactions in ANOVA).\n- Call it *parabola model*.\n\n## Parabola model output\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n\n```{.r .cell-code}\n# tidy(DC.2)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n\\scriptsize\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.968 0.965 0.123 328. 4.16e-17 2 18.6 -29.2 -24.3\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n\n\n\\normalsize\n\n## Comments on output\n\n- R-squared has gone up a lot, from 87% (line) to 97% (parabola).\n- Coefficient of squared term strongly significant (P-value\n $6.59 \\times 10^{−8}$).\n- Adding squared term has definitely improved fit of model.\n- Parabola model better than linear one.\n- But...need to check residuals again.\n\n## Residual plot from parabola model\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(y = .resid, x = .fitted)) +\n geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-18-1.pdf)\n:::\n:::\n\n\n\n## normal quantile plot of residuals\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-3-1.pdf)\n:::\n:::\n\n\n\nThis distribution has long tails, which should worry us at least some.\n\n## Make scatterplot with fitted line and curve\n\n- Residual plot basically random. Good.\n- Scatterplot with fitted line and curve like this:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method = \"lm\", se = F) +\n geom_line(data = DC.2, aes(y = .fitted))\n```\n:::\n\n\n\n## Comments\n\n- This plots:\n - scatterplot (`geom_point`);\n - straight line (via tweak to `geom_smooth`, which draws\n best-fitting line);\n - fitted curve, using the predicted `DC_output` values, joined by\n lines (with points not shown).\n- Trick in the `geom_line` is use the predictions as the `y`-points to\n join by lines (from `DC.2`), instead of the original data points.\n Without the `data` and `aes` in the `geom_line`, original data\n points would be joined by lines.\n\n## Scatterplot with fitted line and curve\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-19-1.pdf)\n:::\n:::\n\n\n\nCurve clearly fits better than line.\n\n## Another approach to a curve\n\n- There is a problem with parabolas, which we'll see later.\n\n- Ask engineer, \"what should happen as wind velocity increases?\":\n\n - Upper limit on electricity generated, but otherwise, the larger\n the wind velocity, the more electricity generated.\n\n- Mathematically, *asymptote*. Straight lines and parabolas don't have\n them, but eg. $y = 1/x$ does: as $x$ gets bigger, $y$ approaches\n zero without reaching it.\n\n- What happens to $y = a + b(1/x)$ as $x$ gets large?\n\n - $y$ gets closer and closer to $a$: that is, $a$ is asymptote.\n\n- Fit this, call it asymptote model.\n\n- Fitting the model here because we have math to justify it.\n\n - Alternative, $y = a + be^{−x}$ , approaches asymptote faster.\n\n## How to fit asymptote model?\n\n- Define new explanatory variable to be $1/x$, and predict $y$ from\n it.\n- $x$ is velocity, distance over time.\n- So $1/x$ is time over distance. In walking world, if you walk 5\n km/h, take 12 minutes to walk 1 km, called your pace. So 1 over\n `wind_velocity` we call `wind_pace`.\n- Make a scatterplot first to check for straightness (next page).\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwindmill %>% mutate(wind_pace = 1 / wind_velocity) -> windmill\nggplot(windmill, aes(y = DC_output, x = wind_pace)) +\n geom_point() + geom_smooth(se = F)\n```\n:::\n\n\n\n- and run regression like this (output page after):\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.3 <- lm(DC_output ~ wind_pace, data = windmill)\nsummary(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_pace, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.20547 -0.04940 0.01100 0.08352 0.12204 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 2.9789 0.0449 66.34 <2e-16 ***\nwind_pace -6.9345 0.2064 -33.59 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.09417 on 23 degrees of freedom\nMultiple R-squared: 0.98,\tAdjusted R-squared: 0.9792 \nF-statistic: 1128 on 1 and 23 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n## Scatterplot for wind_pace\n\nPretty straight. Blue actually smooth curve not line:\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-20-1.pdf)\n:::\n:::\n\n\n\n## Regression output\n\n\\scriptsize\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.980 0.979 0.0942 1128. 4.74e-21 1 24.6 -43.3 -39.6\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n\n\n\\normalsize\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n## Comments\n\n- R-squared, 98%, even higher than for parabola model (97%).\n- Simpler model, only one explanatory variable (`wind.pace`) vs. 2 for\n parabola model (`wind.velocity` and its square).\n- `wind.pace` (unsurprisingly) strongly significant.\n- Looks good, but check residual plot (over).\n\n## Residual plot for asymptote model\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/resida-1.pdf)\n:::\n:::\n\n\n\n## normal quantile plot of residuals\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-4-1.pdf)\n:::\n:::\n\n\n\nThis is skewed (left), but is not bad (and definitely better than the\none for the parabola model).\n\n## Plotting trends on scatterplot\n\n- Residual plot not bad. But residuals go up to 0.10 and down to\n −0.20, suggesting possible skewness (not normal). I think it's not\n perfect, but OK overall.\n- Next: plot scatterplot with all three fitted lines/curves on it (for\n comparison), with legend saying which is which.\n- First make data frame containing what we need, taken from the right\n places:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 <- tibble(\n wind_velocity = windmill$wind_velocity,\n DC_output = windmill$DC_output,\n linear = fitted(DC.1),\n parabola = fitted(DC.2),\n asymptote = fitted(DC.3)\n)\n```\n:::\n\n\n\n## What's in `w2`\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 25 x 5\n wind_velocity DC_output linear parabola asymptote\n \n 1 5 1.58 1.34 1.51 1.59 \n 2 6 1.82 1.58 1.81 1.82 \n 3 3.4 1.06 0.951 0.861 0.939\n 4 2.7 0.5 0.782 0.518 0.411\n 5 10 2.24 2.54 2.26 2.29 \n 6 9.7 2.39 2.47 2.27 2.26 \n 7 9.55 2.29 2.43 2.27 2.25 \n 8 3.05 0.558 0.866 0.694 0.705\n 9 8.15 2.17 2.10 2.20 2.13 \n10 6.2 1.87 1.63 1.86 1.86 \n# i 15 more rows\n```\n\n\n:::\n:::\n\n\n\n## Making the plot\n\n- `ggplot` likes to have one column of $x$'s to plot, and one column\n of $y$'s, with another column for distinguishing things.\n- But we have three columns of fitted values, that need to be combined\n into one.\n- `pivot_longer`, then plot:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 %>%\n pivot_longer(linear:asymptote, names_to=\"model\", \n values_to=\"fit\") %>%\n ggplot(aes(x = wind_velocity, y = DC_output)) +\n geom_point() +\n geom_line(aes(y = fit, colour = model)) \n```\n:::\n\n\n\n## Scatterplot with fitted curves\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-25-1.pdf)\n:::\n:::\n\n\n\n## Comments\n\n- Predictions from curves are very similar.\n- Predictions from asymptote model as good, and from simpler model\n (one $x$ not two), so prefer those.\n- Go back to asymptote model summary.\n\n## Asymptote model summary\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n## Comments\n\n- Intercept in this model about 3.\n- Intercept of asymptote model is the asymptote (upper limit of\n `DC.output`).\n- Not close to asymptote yet.\n- Therefore, from this model, wind could get stronger and would\n generate appreciably more electricity.\n- This is extrapolation! Would like more data from times when\n `wind.velocity` higher.\n- Slope −7. Why negative?\n - As wind.velocity increases, wind.pace goes down, and DC.output\n goes up. Check.\n- Actual slope number hard to interpret.\n\n## Checking back in with research questions\n\n- Is there a relationship between wind speed and current generated?\n - Yes.\n- If so, what kind of relationship is it?\n - One with an asymptote.\n- Can we model the relationship, in such a way that we can do\n predictions?\n - Yes, see model DC.3 and plot of fitted curve.\n- Good. Job done.\n\n## Job done, kinda\n\n- Just because the parabola model and asymptote model agree over the\n range of the data, doesn't necessarily mean they agree everywhere.\n- Extend range of wind.velocity to 1 to 16 (steps of 0.5), and predict\n DC.output according to the two models:\n\n\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nwv <- seq(1, 16, 0.5)\nwv\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0\n[14] 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5\n[27] 14.0 14.5 15.0 15.5 16.0\n```\n\n\n:::\n:::\n\n\n\n- R has `predict`, which requires what to predict for, as data frame.\n The data frame has to contain values, with matching names, for all\n explanatory variables in regression(s).\n\n## Setting up data frame to predict from\n\n- Linear model had just `wind_velocity`.\n- Parabola model had that as well (squared one will be calculated)\n- Asymptote model had just `wind_pace` (reciprocal of velocity).\n- So create data frame called `wv_new` with those in:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new <- tibble(wind_velocity = wv, wind_pace = 1 / wv)\n```\n:::\n\n\n\n## `wv_new`\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 31 x 2\n wind_velocity wind_pace\n \n 1 1 1 \n 2 1.5 0.667\n 3 2 0.5 \n 4 2.5 0.4 \n 5 3 0.333\n 6 3.5 0.286\n 7 4 0.25 \n 8 4.5 0.222\n 9 5 0.2 \n10 5.5 0.182\n# i 21 more rows\n```\n\n\n:::\n:::\n\n\n\n## Doing predictions, one for each model\n\n- Use same names as before:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlinear <- predict(DC.1, wv_new)\nparabola <- predict(DC.2, wv_new)\nasymptote <- predict(DC.3, wv_new)\n```\n:::\n\n\n\n- Put it all into a data frame for plotting, along with original data:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits <- tibble(\n wind_velocity = wv_new$wind_velocity,\n linear, parabola, asymptote\n)\n```\n:::\n\n\n\n## `my_fits`\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 31 x 4\n wind_velocity linear parabola asymptote\n \n 1 1 0.372 -0.471 -3.96 \n 2 1.5 0.493 -0.157 -1.64 \n 3 2 0.613 0.137 -0.488\n 4 2.5 0.734 0.413 0.205\n 5 3 0.854 0.670 0.667\n 6 3.5 0.975 0.907 0.998\n 7 4 1.10 1.13 1.25 \n 8 4.5 1.22 1.33 1.44 \n 9 5 1.34 1.51 1.59 \n10 5.5 1.46 1.67 1.72 \n# i 21 more rows\n```\n\n\n:::\n:::\n\n\n\n## Making a plot 1/2\n\n- To make a plot, we use the same trick as last time to get all three\n predictions on a plot with a legend (saving result to add to later):\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits %>%\n pivot_longer(\n linear:asymptote,\n names_to=\"model\", \n values_to=\"fit\"\n ) %>%\n ggplot(aes(\n y = fit, x = wind_velocity,\n colour = model\n )) + geom_line() -> g\n```\n:::\n\n\n\n## Making a plot 2/2\n\n- The observed wind velocities were in this range:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n(vels <- range(windmill$wind_velocity))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2.45 10.20\n```\n\n\n:::\n:::\n\n\n\n- `DC.output` between 0 and 3 from asymptote model. Add rectangle to\n graph around where the data were:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ng + geom_rect(\n xmin = vels[1], xmax = vels[2], ymin = 0, ymax = 3,\n alpha=0, colour = \"black\"\n)\n```\n:::\n\n\n\n## The plot\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-35-1.pdf)\n:::\n:::\n\n\n\n## Comments (1)\n\n- Over range of data, two models agree with each other well.\n- Outside range of data, they disagree violently!\n- For larger `wind.velocity`, asymptote model behaves reasonably,\n parabola model does not.\n- What happens as `wind.velocity` goes to zero? Should find\n `DC.output` goes to zero as well. Does it?\n\n## Comments (2)\n\n- For parabola model:\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 3 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) -1.16 0.175 -6.62 1.18e- 6\n2 wind_velocity 0.723 0.0614 11.8 5.77e-11\n3 I(wind_velocity^2) -0.0381 0.00480 -7.95 6.59e- 8\n```\n\n\n:::\n:::\n\n\n\n- Nope, goes to −1.16 (intercept), actually significantly different\n from zero.\n\n## Comments (3): asymptote model\n\n\\small\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n\\normalsize\n\n- As `wind.velocity` heads to 0, wind.pace heads to $+\\infty$, so\n DC.output heads to $−\\infty$!\n- Also need more data for small `wind.velocity` to understand\n relationship. (Is there a lower asymptote?)\n- Best we can do now is to predict `DC.output` to be zero for small\n `wind.velocity`.\n- Assumes a \"threshold\" wind velocity below which no electricity\n generated at all.\n\n## Summary\n\n- Often, in data analysis, there is no completely satisfactory\n conclusion, as here.\n- Have to settle for model that works OK, with restrictions.\n- Always something else you can try.\n- At some point you have to say \"I stop.\"\n", + "markdown": "---\ntitle: \"Case study: windmill\"\neditor: \n markdown: \n wrap: 72\n---\n\n\n\n\n## The windmill data\n\n- Engineer: does amount of electricity generated by windmill depend on\n how strongly wind blowing?\n- Measurements of wind speed and DC current generated at various\n times.\n- Assume the \"various times\" to be randomly selected --- aim to\n generalize to \"this windmill at all times\".\n- Research questions:\n - Relationship between wind speed and current generated?\n - If so, what kind of relationship?\n - Can we model relationship to do predictions?\n\n## Packages for this section\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\nlibrary(broom)\n```\n:::\n\n\n\n\n## Reading in the data\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_url <- \n \"http://ritsokiguess.site/datafiles/windmill.csv\"\nwindmill <- read_csv(my_url)\nwindmill\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 25 x 2\n wind_velocity DC_output\n \n 1 5 1.58 \n 2 6 1.82 \n 3 3.4 1.06 \n 4 2.7 0.5 \n 5 10 2.24 \n 6 9.7 2.39 \n 7 9.55 2.29 \n 8 3.05 0.558\n 9 8.15 2.17 \n10 6.2 1.87 \n# i 15 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Strategy\n\n- Two quantitative variables, looking for relationship: regression\n methods.\n- Start with picture (scatterplot).\n- Fit models and do model checking, fixing up things as necessary.\n- Scatterplot:\n - 2 variables, `DC_output` and `wind_velocity`.\n - First is output/response, other is input/explanatory.\n - Put `DC_output` on vertical scale.\n- Add trend, but don't want to assume linear:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth() \n```\n:::\n\n\n\n\n## Scatterplot\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-5-1.pdf)\n:::\n:::\n\n\n\n\n## Comments\n\n- Definitely a relationship: as wind velocity increases, so does DC\n output. (As you'd expect.)\n- Is relationship linear? To help judge, `geom_smooth` smooths\n scatterplot trend. (Trend called \"loess\", \"Locally weighted least\n squares\" which downweights outliers. Not constrained to be\n straight.)\n- Trend more or less linear for while, then curves downwards\n (levelling off?). Straight line not so good here.\n\n## Fit a straight line (and see what happens)\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.1 <- lm(DC_output ~ wind_velocity, data = windmill)\nsummary(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.59869 -0.14099 0.06059 0.17262 0.32184 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 0.13088 0.12599 1.039 0.31 \nwind_velocity 0.24115 0.01905 12.659 7.55e-12 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.2361 on 23 degrees of freedom\nMultiple R-squared: 0.8745,\tAdjusted R-squared: 0.869 \nF-statistic: 160.3 on 1 and 23 DF, p-value: 7.546e-12\n```\n\n\n:::\n:::\n\n\n\n\n## Another way of looking at the output\n\n- The standard output tends to go off the bottom of the page rather\n easily. Package `broom` has these:\n\n\\scriptsize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.874 0.869 0.236 160. 7.55e-12 1 1.66 2.68 6.33\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n\n\n\n\\normalsize\n\nshowing that the R-squared is 87%, and\n\n\\footnotesize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.1)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 0.131 0.126 1.04 3.10e- 1\n2 wind_velocity 0.241 0.0190 12.7 7.55e-12\n```\n\n\n:::\n:::\n\n\n\n\n\\normalsize\n\nshowing the intercept and slope and their significance.\n\n## Comments\n\n- Strategy: `lm` actually fits the regression. Store results in a\n variable. Then look at the results, eg. via `summary` or\n `glance`/`tidy`.\n- My strategy for model names: base on response variable (or data\n frame name) and a number. Allows me to fit several models to same\n data and keep track of which is which.\n- Results actually pretty good: `wind.velocity` strongly significant,\n R-squared (87%) high.\n- How to check whether regression is appropriate? Look at the\n residuals, observed minus predicted, plotted against fitted\n (predicted).\n- Plot using the regression object as \"data frame\" (in a couple of\n slides).\n\n## Scatterplot, but with line\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method=\"lm\", se = FALSE)\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-11-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\n## Plot of residuals against fitted values\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-13-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\n## Comments on residual plot\n\n- Residual plot should be a random scatter of points.\n- Should be no pattern \"left over\" after fitting the regression.\n- Smooth trend should be more or less straight across at 0.\n- Here, have a curved trend on residual plot.\n- This means original relationship must have been a curve (as we saw\n on original scatterplot).\n- Possible ways to fit a curve:\n - Add a squared term in explanatory variable.\n - Transform response variable (doesn't work well here).\n - See what science tells you about mathematical form of\n relationship, and try to apply.\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.1, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-1-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\n## Parabolas and fitting parabola model\n\n- A parabola has equation $$y = ax^2 + bx + c$$ with coefficients\n $a, b, c$. About the simplest function that is not a straight line.\n- Fit one using `lm` by adding $x^2$ to right side of model formula\n with +:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.2 <- lm(DC_output ~ wind_velocity + I(wind_velocity^2),\n data = windmill\n)\n```\n:::\n\n\n\n\n- The `I()` necessary because `^` in model formula otherwise means\n something different (to do with interactions in ANOVA).\n- Call it *parabola model*.\n\n## Parabola model output\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n\n```{.r .cell-code}\n# tidy(DC.2)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nsummary(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_velocity + I(wind_velocity^2), \n data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.26347 -0.02537 0.01264 0.03908 0.19903 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -1.155898 0.174650 -6.618 1.18e-06 ***\nwind_velocity 0.722936 0.061425 11.769 5.77e-11 ***\nI(wind_velocity^2) -0.038121 0.004797 -7.947 6.59e-08 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.1227 on 22 degrees of freedom\nMultiple R-squared: 0.9676,\tAdjusted R-squared: 0.9646 \nF-statistic: 328.3 on 2 and 22 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n\n\\scriptsize\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.968 0.965 0.123 328. 4.16e-17 2 18.6 -29.2 -24.3\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n\n\n\n\\normalsize\n\n## Comments on output\n\n- R-squared has gone up a lot, from 87% (line) to 97% (parabola).\n- Coefficient of squared term strongly significant (P-value\n $6.59 \\times 10^{−8}$).\n- Adding squared term has definitely improved fit of model.\n- Parabola model better than linear one.\n- But...need to check residuals again.\n\n## Residual plot from parabola model\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(y = .resid, x = .fitted)) +\n geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-18-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.2, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-3-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nThis distribution has long tails, which should worry us at least some.\n\n## Make scatterplot with fitted line and curve\n\n- Residual plot basically random. Good.\n- Scatterplot with fitted line and curve like this:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(windmill, aes(y = DC_output, x = wind_velocity)) +\n geom_point() + geom_smooth(method = \"lm\", se = F) +\n geom_line(data = DC.2, aes(y = .fitted))\n```\n:::\n\n\n\n\n## Comments\n\n- This plots:\n - scatterplot (`geom_point`);\n - straight line (via tweak to `geom_smooth`, which draws\n best-fitting line);\n - fitted curve, using the predicted `DC_output` values, joined by\n lines (with points not shown).\n- Trick in the `geom_line` is use the predictions as the `y`-points to\n join by lines (from `DC.2`), instead of the original data points.\n Without the `data` and `aes` in the `geom_line`, original data\n points would be joined by lines.\n\n## Scatterplot with fitted line and curve\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-19-1.pdf)\n:::\n:::\n\n\n\n\nCurve clearly fits better than line.\n\n## Another approach to a curve\n\n- There is a problem with parabolas, which we'll see later.\n\n- Ask engineer, \"what should happen as wind velocity increases?\":\n\n - Upper limit on electricity generated, but otherwise, the larger\n the wind velocity, the more electricity generated.\n\n- Mathematically, *asymptote*. Straight lines and parabolas don't have\n them, but eg. $y = 1/x$ does: as $x$ gets bigger, $y$ approaches\n zero without reaching it.\n\n- What happens to $y = a + b(1/x)$ as $x$ gets large?\n\n - $y$ gets closer and closer to $a$: that is, $a$ is asymptote.\n\n- Fit this, call it asymptote model.\n\n- Fitting the model here because we have math to justify it.\n\n - Alternative, $y = a + be^{−x}$ , approaches asymptote faster.\n\n## How to fit asymptote model?\n\n- Define new explanatory variable to be $1/x$, and predict $y$ from\n it.\n- $x$ is velocity, distance over time.\n- So $1/x$ is time over distance. In walking world, if you walk 5\n km/h, take 12 minutes to walk 1 km, called your pace. So 1 over\n `wind_velocity` we call `wind_pace`.\n- Make a scatterplot first to check for straightness (next page).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwindmill %>% mutate(wind_pace = 1 / wind_velocity) -> windmill\nggplot(windmill, aes(y = DC_output, x = wind_pace)) +\n geom_point() + geom_smooth(se = F)\n```\n:::\n\n\n\n\n## and run regression like this:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nDC.3 <- lm(DC_output ~ wind_pace, data = windmill)\nsummary(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\nCall:\nlm(formula = DC_output ~ wind_pace, data = windmill)\n\nResiduals:\n Min 1Q Median 3Q Max \n-0.20547 -0.04940 0.01100 0.08352 0.12204 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 2.9789 0.0449 66.34 <2e-16 ***\nwind_pace -6.9345 0.2064 -33.59 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.09417 on 23 degrees of freedom\nMultiple R-squared: 0.98,\tAdjusted R-squared: 0.9792 \nF-statistic: 1128 on 1 and 23 DF, p-value: < 2.2e-16\n```\n\n\n:::\n:::\n\n\n\n\n## Scatterplot for wind_pace\n\nPretty straight. Blue actually smooth curve not line:\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-20-1.pdf)\n:::\n:::\n\n\n\n\n## Regression output\n\n\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nglance(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 1 x 12\n r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC\n \n1 0.980 0.979 0.0942 1128. 4.74e-21 1 24.6 -43.3 -39.6\n# i 3 more variables: deviance , df.residual , nobs \n```\n\n\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n\n## Comments\n\n- R-squared, 98%, even higher than for parabola model (97%).\n- Simpler model, only one explanatory variable (`wind.pace`) vs. 2 for\n parabola model (`wind.velocity` and its square).\n- `wind.pace` (unsurprisingly) strongly significant.\n- Looks good, but check residual plot (over).\n\n## Residual plot for asymptote model\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(y = .resid, x = .fitted)) + geom_point()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/resida-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\n## normal quantile plot of residuals\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(DC.3, aes(sample = .resid)) + stat_qq() + stat_qq_line()\n```\n\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/unnamed-chunk-4-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n\nThis is skewed (left), but is not bad (and definitely better than the\none for the parabola model).\n\n## Plotting trends on scatterplot\n\n- Residual plot not bad. But residuals go up to 0.10 and down to\n −0.20, suggesting possible skewness (not normal). I think it's not\n perfect, but OK overall.\n- Next: plot scatterplot with all three fitted lines/curves on it (for\n comparison), with legend saying which is which.\n- First make data frame containing what we need, taken from the right\n places:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 <- tibble(\n wind_velocity = windmill$wind_velocity,\n DC_output = windmill$DC_output,\n linear = fitted(DC.1),\n parabola = fitted(DC.2),\n asymptote = fitted(DC.3)\n)\n```\n:::\n\n\n\n\n## What's in `w2`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 25 x 5\n wind_velocity DC_output linear parabola asymptote\n \n 1 5 1.58 1.34 1.51 1.59 \n 2 6 1.82 1.58 1.81 1.82 \n 3 3.4 1.06 0.951 0.861 0.939\n 4 2.7 0.5 0.782 0.518 0.411\n 5 10 2.24 2.54 2.26 2.29 \n 6 9.7 2.39 2.47 2.27 2.26 \n 7 9.55 2.29 2.43 2.27 2.25 \n 8 3.05 0.558 0.866 0.694 0.705\n 9 8.15 2.17 2.10 2.20 2.13 \n10 6.2 1.87 1.63 1.86 1.86 \n# i 15 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Making the plot\n\n- `ggplot` likes to have one column of $x$'s to plot, and one column\n of $y$'s, with another column for distinguishing things.\n- But we have three columns of fitted values, that need to be combined\n into one.\n- `pivot_longer`, then plot:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nw2 %>%\n pivot_longer(linear:asymptote, names_to=\"model\", \n values_to=\"fit\") %>%\n ggplot(aes(x = wind_velocity, y = DC_output)) +\n geom_point() +\n geom_line(aes(y = fit, colour = model)) \n```\n:::\n\n\n\n\n## Scatterplot with fitted curves\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-25-1.pdf)\n:::\n:::\n\n\n\n\n## Comments\n\n- Predictions from curves are very similar.\n- Predictions from asymptote model as good, and from simpler model\n (one $x$ not two), so prefer those.\n- Go back to asymptote model summary.\n\n## Asymptote model summary\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n\n## Comments\n\n- Intercept in this model about 3.\n- Intercept of asymptote model is the asymptote (upper limit of\n `DC.output`).\n- Not close to asymptote yet.\n- Therefore, from this model, wind could get stronger and would\n generate appreciably more electricity.\n- This is extrapolation! Would like more data from times when\n `wind.velocity` higher.\n- Slope −7. Why negative?\n - As wind.velocity increases, wind.pace goes down, and DC.output\n goes up. Check.\n- Actual slope number hard to interpret.\n\n## Checking back in with research questions\n\n- Is there a relationship between wind speed and current generated?\n - Yes.\n- If so, what kind of relationship is it?\n - One with an asymptote.\n- Can we model the relationship, in such a way that we can do\n predictions?\n - Yes, see model DC.3 and plot of fitted curve.\n- Good. Job done.\n\n## Job done, kinda\n\n- Just because the parabola model and asymptote model agree over the\n range of the data, doesn't necessarily mean they agree everywhere.\n- Extend range of wind.velocity to 1 to 16 (steps of 0.5), and predict\n DC.output according to the two models:\n\n\n\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nwv <- seq(1, 16, 0.5)\nwv\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0\n[14] 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5\n[27] 14.0 14.5 15.0 15.5 16.0\n```\n\n\n:::\n:::\n\n\n\n\n- R has `predict`, which requires what to predict for, as data frame.\n The data frame has to contain values, with matching names, for all\n explanatory variables in regression(s).\n\n## Setting up data frame to predict from\n\n- Linear model had just `wind_velocity`.\n- Parabola model had that as well (squared one will be calculated)\n- Asymptote model had just `wind_pace` (reciprocal of velocity).\n- So create data frame called `wv_new` with those in:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new <- tibble(wind_velocity = wv, wind_pace = 1 / wv)\n```\n:::\n\n\n\n\n## `wv_new`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nwv_new\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 31 x 2\n wind_velocity wind_pace\n \n 1 1 1 \n 2 1.5 0.667\n 3 2 0.5 \n 4 2.5 0.4 \n 5 3 0.333\n 6 3.5 0.286\n 7 4 0.25 \n 8 4.5 0.222\n 9 5 0.2 \n10 5.5 0.182\n# i 21 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Doing predictions, one for each model\n\n- Use same names as before:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlinear <- predict(DC.1, wv_new)\nparabola <- predict(DC.2, wv_new)\nasymptote <- predict(DC.3, wv_new)\n```\n:::\n\n\n\n\n- Put it all into a data frame for plotting, along with original data:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits <- tibble(\n wind_velocity = wv_new$wind_velocity,\n linear, parabola, asymptote\n)\n```\n:::\n\n\n\n\n## `my_fits`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 31 x 4\n wind_velocity linear parabola asymptote\n \n 1 1 0.372 -0.471 -3.96 \n 2 1.5 0.493 -0.157 -1.64 \n 3 2 0.613 0.137 -0.488\n 4 2.5 0.734 0.413 0.205\n 5 3 0.854 0.670 0.667\n 6 3.5 0.975 0.907 0.998\n 7 4 1.10 1.13 1.25 \n 8 4.5 1.22 1.33 1.44 \n 9 5 1.34 1.51 1.59 \n10 5.5 1.46 1.67 1.72 \n# i 21 more rows\n```\n\n\n:::\n:::\n\n\n\n\n## Making a plot 1/2\n\n- To make a plot, we use the same trick as last time to get all three\n predictions on a plot with a legend (saving result to add to later):\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmy_fits %>%\n pivot_longer(\n linear:asymptote,\n names_to=\"model\", \n values_to=\"fit\"\n ) %>%\n ggplot(aes(\n y = fit, x = wind_velocity,\n colour = model\n )) + geom_line() -> g\n```\n:::\n\n\n\n\n## Making a plot 2/2\n\n- The observed wind velocities were in this range:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n(vels <- range(windmill$wind_velocity))\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n[1] 2.45 10.20\n```\n\n\n:::\n:::\n\n\n\n\n- `DC.output` between 0 and 3 from asymptote model. Add rectangle to\n graph around where the data were:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ng + geom_rect(\n xmin = vels[1], xmax = vels[2], ymin = 0, ymax = 3,\n alpha=0, colour = \"black\"\n)\n```\n:::\n\n\n\n\n## The plot\n\n\n\n\n::: {.cell}\n::: {.cell-output-display}\n![](windmill_files/figure-beamer/windmill-35-1.pdf)\n:::\n:::\n\n\n\n\n## Comments (1)\n\n- Over range of data, two models agree with each other well.\n- Outside range of data, they disagree violently!\n- For larger `wind.velocity`, asymptote model behaves reasonably,\n parabola model does not.\n- What happens as `wind.velocity` goes to zero? Should find\n `DC.output` goes to zero as well. Does it?\n\n## Comments (2)\n\n- For parabola model:\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.2)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 3 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) -1.16 0.175 -6.62 1.18e- 6\n2 wind_velocity 0.723 0.0614 11.8 5.77e-11\n3 I(wind_velocity^2) -0.0381 0.00480 -7.95 6.59e- 8\n```\n\n\n:::\n:::\n\n\n\n\n- Nope, goes to −1.16 (intercept), actually significantly different\n from zero.\n\n## Comments (3): asymptote model\n\n\\small\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ntidy(DC.3)\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n# A tibble: 2 x 5\n term estimate std.error statistic p.value\n \n1 (Intercept) 2.98 0.0449 66.3 8.92e-28\n2 wind_pace -6.93 0.206 -33.6 4.74e-21\n```\n\n\n:::\n:::\n\n\n\n\n\\normalsize\n\n- As `wind.velocity` heads to 0, wind.pace heads to $+\\infty$, so\n DC.output heads to $−\\infty$!\n- Also need more data for small `wind.velocity` to understand\n relationship. (Is there a lower asymptote?)\n- Best we can do now is to predict `DC.output` to be zero for small\n `wind.velocity`.\n- Assumes a \"threshold\" wind velocity below which no electricity\n generated at all.\n\n## Summary\n\n- Often, in data analysis, there is no completely satisfactory\n conclusion, as here.\n- Have to settle for model that works OK, with restrictions.\n- Always something else you can try.\n- At some point you have to say \"I stop.\"\n", "supporting": [ "windmill_files/figure-beamer" ], diff --git a/_freeze/windmill/figure-beamer/resida-1.pdf b/_freeze/windmill/figure-beamer/resida-1.pdf index 526deb728cf5ab4ce3e0d6ba9890ab2b2de0714f..1b00089aa21856237262b98bdb3198636ec9a662 100644 GIT binary patch delta 1064 zcmZWo%Wl&^6cw!Kv3!vf(HP9}|wH-ei6jh>0Q&rGXCG0{LQ+tva98WbKS78<9 z6Oh+@MOQ5N1jK?5Kmv*H;7;14A(_p{XU^Pnea@Y)-o$!PI&Cyx*kzZMCch_tCO;-W z-z#Ppzu1#!wrxAMRqX=`({}bKM1O ziA?4yq=N2JLBqJ}fZ-dF_VoZ9$MWIw-tBL9KA%4t&l1i~x0-9DN`_G^l*r-? zu$)RAi5{SeQyP?zj8782fDiJt&s9E5`2Ac1%Dzm+Mq( zW&|n96FwwuN}>3&zBOKmaHK?!Szz1DnlJD@ui`-u=9pu{^c2!LX8SbAX5Cg5w7~UQ#UhBC zMXVwY+^KTlFTjP%p7;Tr;lKfL;;={l00$)Aahh$qk-&=-jUf*pMc}R#Y3j=ti3TkT6y)|KR$fMJM3D$vD#~| z_KI(wJ+Pkq@}RN$-B&+;VqNR}v-%gA{{70E6GA(W#}ep~7)nALd8TEi3oun$gtlan zmnxD4@R{MRj1y7M&!EfDuwyfD1KuMTt}qU~%4>h0$SgKZ+W03XBGc;CX&4~$QQ#yD|43KGI$|T!@7LekSV&;nHwn7*u+gZCLdJj! zK>WSw==zNnGX3^?V*n2ngHyij$eiNlc% zM)xf+Q+`20i%pqjnJ1Vnhf!@|wy;Ef;UI1&aRFTi{U)u&NPBs&8bXUSA7Vk1V|fu5 zyTzX3GQ!o^#Et35V{^MOi+hX0LG%1I$+PhMgSE+}%(j_(ld+rsrNm2@juPWBDup&h zTHqZsTkbMV`y$Is6P=T!0Q}6F`3OFfs=%7yShj0>0rx#;n_GT3ZxbWrG2BT`C7}A9 zEqF8*`lOHoPA?*T%drs6rSi{|91sS!GyQY@tqFIKQu9Ctr24_UAV7w$+Hl)~B^$GG zY*+n!=HX^tweg+ZrF=Z#c&#!vSuE@@yn9{T=Uh(6>a$(zE^7Czf!KRhK3sd2r z1<-c#r9=h@ebUNvlvkxuLd~@Zwvh+k_lF^L_gLtAUQlDZL0Dr4yH1VUJ8q+13mQ&X d+YP;a_c?i@Q#QBc#f=zW2WK_dS2{KC;{8{Z@OGS6ot_{+Rxpew}`M ztqIS6k%x~t=MHC8&t)rw?y9gQjD+RZGlx0uc`dJ&DjNtaSHC1O-CV&h{pFXZ$%oEo23Ibf?+e6sZiMW?B82;r4B2_(p7` zPOJ!R$>S)Hb|~G0r7HZh##^faZAX@g_ZZ178K_XgseiLVu49a;!DL7I@6w|ykl(q{ zoDlB1G*l**X&M0?YH^GTBFL;z5a}Qr4PrS4YN8ki(UAzWN`M|{X^Ge=f&jxLG>oK{ zX@n6}5@kX;0IH(|cOyXK<5zp-SXCBnmq^|9<1alUb;R4)kf!PZZAjJb?yoO795pz5r_v}Bc zR=d>e`2OYII>V4I_M$BQDU8)G2s>*9IFETAyCmZIUOj($ZxN49canj^&9!?*J4zX_ YKcL+?k{Y2+@v&ar^GLb8^|DR=01KWPvH$=8 delta 1680 zcmah}&1)M+6psRdGQI?Y-9uCQ9HPc zoOJHd=+ZxhCn6cC6R<3pKV;S@!S-(-zcIV)TGPAH&u%{Y@%Nwq{=w-^ zzW;-~xqj`_?HhlQS&6(iCA9l;B7h$9ks#Dd6D1OrfzIC{v?H=Kmx0K@yfi!&VZ@v1 zIrJDBYHSbey4fcfE-? zhr9DE8rQRYJP;BVi4T%t>PLYB7uZyzY%T$r3>;=7pe1rm@u5tEBcY&&MEPx?U2(1e zz1qkZG#ZG(gqp^V&}r*jJv>re2|OYD`$%e>%A*Mn3IokL51X(zC+emSm=Dl24V%1b zlwQAcOY@g0iTD;wx))m?e8^npn#?dw2jM+ULthu!@$Z|=w3lZWz3O9z4j#sT!LV%_rV6K(MRX+jnV>w#m7qZ+gM2)U#W__`911$-flL!RkOF-$ga-jiiH4Do zB8xIwO;Qz#A(c@wq5?7j(o&rK8|^=XgW$0aY_R&ucyf@-g+OKDQ#@tLNH)0 zX?E(a-jMBAk2da*={nU~>I;VEaxG?jFg8F7x&wM>|B^)i3PXAe76~p@uT_}o^~zB% zNbch(%%EqX-?Vcz(pX;@k1HOhBP^(MtZ&%WZn38@4^ZkmxB*>ptS<~!E!6T>3}{|x zBT5th;-ih}QaTl8-(&3Ff2nKf(v^HN!RgaBk2AbHF1I$1;{i_+-9+~!$^bu?&3po% z37KI{u&Rb_ICax?tcqE6{Y9G?A&%imbS3~5ZSBJ8gsYQGa5$Ssx>c)++Fz>qT#6xK zU|6$1w{A~O3;ELzBtVKE2#ulQS8cdK>o#WK*jD{qRzr4IZDy^$7Hih6y7v3xYGI36 zYY8pp7LF@^mfoJ#BCcVs`ME}|KKu6F+f!6>CrwdCg%%0b*BKaE26&Yn_|R)OzHil< xrqgQG_B^NQv>$jazh&-u4_bAjRk!!y|6Tf8?|=AJX>-udhQ;P;Dr&DLwD*7Z2EIw zGbdXqJbCUoj_dF>-{Y?s?x?USjD(lXH!gR*%YWIYLTSOxz77%t84H-8^2ZtY(Ym2?ogXjqoo*Tu=H#Jvc^(l!W_@T zP?=b!X#_aX;)E1LFtS2Hq=V70AImYIiDD{*LlJ0|0QR)BMA|8WfZEA0jHH%nlmeC# zWkT5p)KNmi5>W7QEavdTQ8EyEG>paFkpWZ#mB`OT6t;A>xcvCVtf_h8*ctUqK7e)% zsg=88NZQne>{ns+-dqdETJ{+S$I13r9!vp0oN1#)6ic07!A|s5(#Zg~lfI&Xw&RCw br3~1Mn%~3J2yOBV{A#Vb$cn|y4=wf&v#TE9 delta 1743 zcmah~O^YK{6rCOzkT;tFncj$adoWJ7PV!!TCXo>6d=2e zje<>bKmPpfFT@50@!&bBR0w@6qLDfW%YxNI=9N7-`1ONVW|!Tl)o=BaJ0Jb<`%nLT z?{p{M{Xt&cyz%kDtv|{90eNdiX!pfL06pa+L1;aWl!#OUx_+C`wn*YsdLjXH2|N*g zz-#dodJKUgD}h}$`vlV^=7F<_s#b}JeBGXb|7UG3&pCTGcrH9eXeS-07n2zt-HPRy zEWQ^Z23G4f&kC&|6i@kBz+r)Y9z^~)2*b~Y2qttGj8ZA`1A(t4O`{0^`g!j>jV|&Q zvNZ9BN2@A&uBYjEAS7gkPoiPm2s{NYu$i8+wi(D|;4m8p+Dxt~K9#Z85ej-pRHFs7 zE2auCs)c+(rGhh`b_~0BF*FScB4vs5?4gwLsH! zisWTw@2@xB)chq%;(QsC?$!P~?=hFTCNnS)$9od{4SmRA<3p2~_U7GHukeUrKppc{ zEa9+ygl%Mnber2N(L-eWz;);)AXN+MaV|3dZU5cewF0_zU7$x#>h&5=gb#)mL%To! z>h8TgGXLgoeFlbYQ$JR?tt6l$$u9-vUaAE30_mmWVJN0l1)(qKn0qpg=s*gL!4&R! zC?)C#LW(3vXd#M~FNRbG(TIAezcA!$5LZ6pG98CJRWu&Ok+`59mp9{R{^kDLNWyWb zgp4##v>`47Payj^99SFLowBPPbMP{~eUHp`sn^oa7+cAAvGbF$0b1Z~&`W$xBK>QO zX;)+gmM+k$Otjrn)DM#VDDV^LSr|8KU(Yml4OHifhw%sx)HQY;cfDKe$xl6${vkS| zE6(%sWcS;Lfr(F+-fe0llzM_f(1@VPIHnB|(~5^iTZ*J4F9)D|{lmSOA$S`O-CE0DQHaVO3-&1;yF9B)jCzY{<^ z!52a^L)&qTs#{2xP<fgc5EYzYTO`B*BtFClHP9ZKu{U;_R8b|GG*tyHRRRYTa@g3L)Zlol^|}hD zC_ka{&*0b}!3_@l1Gw=c5VL8MrmZiQ-@cjmJa6`||IK+=IBYc6-J-_|li!m+lb@4c zpEPsx`%BMXx~|Jzr{sIi8pC}RHiVI|+Sud{_b$)!4@<={Cq`XMVU&i|)*9Q|VloL; z?=$1zfPL3$fbYK^OTfA?B31*yLotvkl!(xR%Yuy?1(s*oS|;X#j&+q7`b?o>%RRuB zOjV`>YUo{SXc^}Y7`~Osz#IYRUIk9q;jDc7`<>I|$#~}N+!DTt!W24St+b#^mQ_a5 zF5tclBeAVU&~fN&gFE0mUU$L06`zS6Y8AAlfezA)NkNWGmtm8fL#>8Q4z6ut|9#AG zXJmHU#!i?fMbjY7Sn2k$2&M?8t=(<#FZc`dwU8C;;9kAHEm9dm*|NH`0PNQ+fY-5+ zIrfUTAYxA2r?@aL^{ZZ{aB6wO%zij9Ew1z1hA*2B~qmb0!ou%7)dSD zCfjonFJ#2yLb_@GF%nD-?F#HQ9eLDk8xE delta 1718 zcmah~&5I*N6yI4`klKqNJ6;suE{;2+CRP2JX$gTzI=zfLyE|l}41}PS?n+s-l-py zjIvGke);u>--rzivffittrB`7(t)}F%Ywy2rqvyo{Ql7kv(0YQ8@Iaoo1gyt=ktGl za@wOGUy>I$Z+v$5*55>=QLd!mLw(Z8thJ==uSWvtDIW+z8(FGEs&dd(TZFbmo)t0_ zIhb?9BN4^Co{gcy&`@EAV0#m@OE6wyAUHF(T5Va#!1rbM^FrrOdQU~D2t6x$YF0YP zS=0gGdW%^Z|M#DHszUZSdr~PV8<6_to5|){d(|+d1p#pafs=fkbGH{rUcvi?Y@uxBi&xC>w66FU# z+hVK$y#nM5PO4R)fe96z4WZNKSUosXTnWI~S`ArEGI=)Q;mknu)`L16E{M|pi?N!f zeMp{FcV52n*7n5Q>)rQ0U@mh_W|*dn=pJQ}uWRi4pP0O2<_7+MUi?)2L`_jbti z`#X&Z7`9ELOyRWhm<}Yr5|oF95;TluSPc7#7*iD|k)T5!$}FWlDbNQ)co?FRXcP-6 z@;ImEG*gl2QyHfN8lwJ^g#Ty6i4V9eh6yhe%?4R2E@{Z+%`BaMv->WRaFi$^Q_U0g z#Z?>%Bp<p0zDoYp!MAXJ;YZe(p_UrFU2y! zdc_>Icbw7)LpD^j1z<>ygIx{xrDaNjAWOI>+|Ht#^w(MMa3p-^Yb$i*tRg zu(Ii_iv!Ke*Emc4>kn^FR#GZ4`#xj$(c!gfTe-9)AB|8AG~h{&m&tsKizMmsG}TSC zFX9~VGjHZ&_*}>wYl2laY{T(P*Re`w+4YxgVuUz{llV#iD%?7N%Mn)>x!`cMh;++V z8PTlNJ(i+R7#P-+y#3C^w2(jjKni4bKxp=s4L1t6V$+W?1IM;$a}9J?aSeCN&ovR`9|#ha+{!YP(M*ek>e~&B#eIG3 zL#Jw)?vWRG^}5T9;K*+}zUKv2P;pqrYx=HNga3EwYLVxPOEsg|wJZ1swby(S?2vx} DAST>k diff --git a/_freeze/windmill/figure-beamer/windmill-11-1.pdf b/_freeze/windmill/figure-beamer/windmill-11-1.pdf index 805c0d4783961d7cff7c366e49e5390526f3c2bb..2656b8526468fc8588811599845c3b2e82f12549 100644 GIT binary patch delta 1025 zcmZWo%We}f6jj+_lvb(`610d5YIrQjwdavGC@P{!Q&rFsCG0{L?u?U8nT#usrwXem zpMd5s*!CM(uwuaC#Cxn2Pnv+6H>1Oe)xPU z02^HMSPlW(d?-?I4WR?u+e9RxC2lTkusq9FBGH$0Y{*2LWeQuxcI=2$W-2iCyleFy zoDj>na6s^#NQU|toK3$5`RkR(=kBd<{&(zvV23?_{hbB;?AjY~+uw|@6y^bvhm@Q%tKOwj~)_YxT z<1|s3IE-d2Rriz!1%hd3ZwLHKKDo-vLRPSc`;Ep9Pelk-%j(YpwW|w9fNx?gRANQ2 zDbAum*rIp{8!r6M#;;WYTajg&cWlT_5y()$`G=JXxoz5%Y9;t6UtNB(1i8Q5m=NZ9 z7)l+BG>rgL@maaKr;86Tl-SEYa-bL15ZRFpPu}X_Nw1 z5~)Km08~+8h9xk;$1$J7kF#XRRW^$GYNi3@P$uG&A#z(f|GWI~*{rEW;@HiObTNQ- z3{5K!`N(LSF67@!8+YegI96gnC@_{EuB}g~!+_cc5+KC~rL1bE_B!S=XAyI#3I7Jq zWo966V*a9r!_3v8bnBY1Q!BuEtV+EFk*Z7Ge1Co2SjYWjAkF03Im3>W8tjcME?la) R(#2t`9;KvQ-hJO9{{XXH7^wgN delta 1714 zcmah}TZBm_3;WF7Z5WP%KYpq1`Qrgu8sp}KmE zPx%Et3;}xBGM>VQt+{U)5+|uq}|Ua0_YJR2|}A$szj=C&{aExc0`^PG88#j zOT$AE#k`SCp~ukRn+%-l%;^)1mlz1{!mVCk7c%jC-TkuA$>YHj5h_BDi-B5{Zf9~# zsQzDgn3$~FIx*UDA|COvfPI607N^lTPLfZCXw2y_9u-oQ2RMSO?#%36cfy?wPo2fPEM=}eKg@PV}6tsbM#Z&=$wGk_* z)qsB3w!qifaBSL|s(Z(ZD}hI(UPnZeOdd~oxG>PXbFTrF6-e5DwNlG>tK?~I?+^0I z?zX&(SKoYxdCaqzX;}_V_b`hBU1LA^z+#rOIlJf?_Zd1gaoZ}Bu-`erF4o)7U0&XX z9%5@1dI5;k0(RQA$o$7!ZzmCPn2tlE zOyQ>Tn2sbr7nFyE5;TluSd52>m{Judk)UH9$}FV=DbNQ)co-s!XcP-6@;IkPnyE+( zsf^PR4Uv0E!v8g%7U_t~Vw~_o(QK5Z;*5q|UeD6`7q{L(5bh>Q$W-G*192XQ0>Q`O zz}~>_Rz0nux1OH8beqg}q1UuuBer7hV&{ir6EwFwpqF@sBK?_AmIBbE%(c`C zMqGEt`2C zJ{B^^nqV8IW4cw#bM3Nac)_|&j1VXAAU+p>47U&9Y{J!PE;yX8B0a-4aGDLfr&0_F z1Jj26Ca&nR&9?2Ge6~|TK`{2| zc46D~@w&MZ>}lm(u~ppNragbh&+{!d{|$#kCU>$7X|&)Xq55_Mb9GlA2GFau9Gl%` vL8W3jLCg1itm>M+=UQ&FYF2!&4*&1c*CfvsmudmASFM<&RBAnL?~#81RrT6+ diff --git a/_freeze/windmill/figure-beamer/windmill-13-1.pdf b/_freeze/windmill/figure-beamer/windmill-13-1.pdf index 575167c1fc2b0a0439360b894e9fae7f9fb722cc..38ef0f7294897a8472963b24701905cf3528aba5 100644 GIT binary patch delta 1107 zcmZWo&2AGh5Eh)kZI2+N9vC5l+Cwwz?K(dw>Y+(fRnSr;2nmH8++8PK*sLS37X=PP zd4wuYg8Cc?3ElwiJOkr2P1DAg)qehF=JPi*|HOCiY2mcd+~LK56()Zse((NJ~8S>NvjQPwYJ&b z9#d)La`}s#fN#GH6<}Rjndm;?sqCu^c8Sn}n}G64fa5u~QK_BNv941~zZq0qcmUW^ zna)i}34=Qc9pma%3}36XZ_mN^MF1B&a2eeH@!(>(Ilk6*B?(`}Q3f4wQd-a@$vUUf z9Pn60vE0`q=y-Hj_B{|@&|OmRieDEyH9Bl73mqi0se&5WF2g1%hguDrK5&=By}ifq zU}O*5);V0OxqMVJ(WX6=;S9m7b+`{=&R_D^L9Sp2kLvY(nW+d$j@7+xfcv{r1XI{} zv;}xVCN7*1)e>McPOLKYO-MjPg*sAj+1)6zht$Q)Qey|x&Gl#ZV7j+nA2S{V7-^fR zEQ8b(%OPsLy(?m8x*- zR@);ES@{4>7Os2+LFNVAxYmV>(e*6FHxN9xlIkQA&?1D?x##Em&iT&GPwa2Ew0qKQ zl}y7SyTASZ%M0QFgJkfSRI7yE6Y)r$f$hTLA+s-b-kP0kU4Q@2k6&6{cCFsn?svBP z>31(58P9%w)Y$(1+aEtOu66&}{)^1^$vaa*yH6(q=m{SQLK{h}M66QKRoaBMMVe&N z7b#eC!+jBiyq;V@kD;M#GH@zZpJ2GeIB;{XT8)S}&>&5GFTl?0oIV^p7QQ01lMU3< z$rMYs5;-RMckW_hw(ilX(F!B+fR6?28T9Kg4#r^=eKka5N{8VnlcF>bcr33DOQwx| zngqlBMF!33K{g%;2}RQ5c$hRpUx7F0Gp#SlSPWd|Aekj=-Q*LQ_#L63hfQj>fOf@& z0`zKOub^5*{1%jTHl$6DF4Ucl;!5BNsnxKdQ6f7N?&k)Yw(r#8V9_M)e|<4R%W|E3 zc+XF^{&?+8-M>^x9>72r9_ zg8E^kgp76nXj7brzQD;KX|S)h%5p1Su}`l*mpiw}baO0vEsB&2Y3G_a9-E-W-v&M9 zS0uCwN^eY&V7?(*wW(gk4E2SBxEls3^lbE-wpSy~&E;xv#iL||1$B55Z*#W2HiSA~P-;x$a-=H*8_)1}Nx%(>0j?f+8Z(xof;WP(beEgq$K(abkI zi=qLKV-2Ev7N&roIhar2OCeLN3ASN6rdzQ**DhIx*DPRSggAwJ;kf`*zr7DnCS0AR zg2VYD(lcxW*({ZRA;pj|FzwkJZ@)XWY;381AO@2EKxz(-W8H?^R@tyIbHmRwwY=72 ztpmK7U$s@rxPgpKR}0&$yaC2GS?;*zXFIrk>qR`%+wk)&bH%14$6Hh4KL*fF_>I60 z5c;g0Bq*<3qlD^f5zNIMf82y#)pILl6LD4SW~Jq_`a$ckVS5L4_o!a3c!zck{@xP6;zfA9M7?hO6@fr>pHdcnL*W+ z`+zN#>D+|W(7)BtF=od+P-)+uf)J$&Tx`OnfA{OXi}NR=nYSxT_%@C*=zz1*f-YIs zIZ1QCLlwnxM-QRn(Z7oDAn^R|f_o=E6FW9KY%2>Lr1VKa4Q-cUlbl1XhD`z7HF0O} zG29*6y|#7f*J`dGX(rmV&t*78Fl+7YKyb}p$k#zmu!H;c`i{(01ZBtS&IaJVt{lPS z!P=vBz#|F~XGsKGWx!^fSY_y)kb#B@b)?|(V6DjR(-bpHyD^xs)#rC$vbkCxG4A^q zX`84livjyaexmuvFemdE#wN@My+jQGZJbae9LUh<6!63-N2E#_hBQ2eQLK#0;ta5u zY8$B@povpjjgWFq61jk%=4oG=e2~b8xdqgHovM#Sl&wFP%A Wr?)P%(%5MRLA6q4g~IN;Ci@GtP$Q%O delta 1750 zcmah~O^X{x5cM7wLOVG*UI+wS7;n5wqUoN`m5dO!G%I`KuSF6;AdAqNX=%qE&4`|! z%_hX?lv^%~4!PzRBnSV7kld0(4k3_3z{mWBkW|k~E6IXn5MoqaT~)8%tJ1gZ54W^? z>^DoM;gH>5e*NJ$;sAqm@SIeuggz3u1KxpPx0hzxndJyT+By-`jr?k%XC&f{*o^4r#B1?tDHGK#%!I5ZXu+B@&f^ z&fOxkC9*V^fyltRFgzAv#Ovu9^cWfrOa@b@V)Y5$mv|A}!mUee3?$g0@ z5hz02`9Kw^o2eWVs=o^l6N7aQyGApL#S=ajuxHTEq9hzgas25JjTs$Aqg;y801=6) zygV(LWo+Lh9PZCUXi!h`@jyseL_JD|sUHOjybD0}B^Zl=%N)eAM6FwYEYqMZ6!fr3 zeiLX%oGC!BCiV)d)sKNTEjZB85H>wLQ}^47D}hI(R>O|QsccVpP#9>|x?hL#yh+-B zPON3w2L+|Cj<)Iw`-ucdr517Y1i9t5Z) z8b(5jEXt^nq$(6cDx+jX1Jqv}^GoANo{YH6$1%?pO-E@WUeJKc2N*EZP4BN1UR1e& zelJ!+Cc1yr7pGAmkQf9F_L35};w`4^omc$oP4Zxq7Cjb=kaJ}t@j#EpCTQ)qK$HB2 zg!;2T$+fB0*2PF@nPz(Ua#R$y{$Uhm(9<*8TC0C^m>OL1I2~aI9b$9(R?EX8!aTrH z*ux3wi1)gB)i9&b(xp^7qPu^7V`sWlQ;9jZ8N2;of?K+DB%e%B5VXnT4EM>!Am?#B z;7OuWcTS=V@Kcn~{Rlo0GKC@Krvgyq_CCCraCMRi z4yW^*o?#m}4oiWbNiif0Ondgv&ihl##y;u?5+KD3LbFiA>oy#!%7%@ZxX#x7JXYC= zXO+#3cvi*3nP6kKSAw@#<@&j|e%8z{LRb8)gSia}k)`9KU{X^%V>@e5$n!ZymTTZiHga3Ew WYmH}$OI5Vqb3Bvm?jAmEl79h7Z{q0y diff --git a/_freeze/windmill/figure-beamer/windmill-19-1.pdf b/_freeze/windmill/figure-beamer/windmill-19-1.pdf index 379409324f763abd334a6502efb062ba02b21394..9c9e6ab66eba71bc7c2eef0c8a90a9aa04b4cac1 100644 GIT binary patch delta 1028 zcmZWoF>ljA7!_uJ$E0IKJw9uEG>$ zW39aM8(1oS24Y}ghLr^|u=1U0XiB}<_kHi)JHPMUyCweDQ3l|VuxA<9ciFT(Nk2ABhw?ag$IXvowgj{mZXil z$As>T%x=e6N6{JNL(N#}&WQ+$3QgO)+u&W`XZ*A!E7+xbjmEY}WeC1S^`?f~)zt8< z*hrmN5!#feQ6McTJ%HsZ{IkZ}@PW1>i^O+~;HC^zDB=9~e1+V?F{TD5JIp_p9^8QZ zYpF3N+;wTFOf1th0y@y*6ct2}S)m}(K{o8ias<>wF%r?C2((Io9%*TTxKjiH4wKL@ zl3Jz_j-Zk#6UshN9VM8J0F94hF;hRzl7Z0KFcx<*15^!EBHtiTSnB-!{Jlrhp%#wQ zPIhF9yxG*@C=bLCwQ&l0Tv}e38R1CFK4HLl{&R6@%p4BPK9B$@J{aRZhV*K!>eSHa z|7ul#<66zFUE`~I9Ak5JFUsOgVXSsV7<2nS(0AB15#ROw{KwJ~9-ZzbeTB)jIiqc* Z4A={3Ge=S*v?+ep_xvg;mv^4G$RB3|9UuSz delta 1714 zcmah}ON%2_6rLWK%^es7L8fKI<6xX_HMzH*Ni+l|sjjh|SCbAyLkxOTb(5}{N>#XZ ztBtGL>axk-a5ulfg`gthLfp6+5&Q#gJvWa@G64-CR8F1ecfRlZ=zRTgxpd1&_<^ye@C{NQva z-~UBkT)oo$( zp@({uj|W1+D(i7FOuZ;j;4TJgt%orgI84v7o?3%`BGcehDCi+bo)5GurV7x@N35XH z0Q!k`b6a|6vf_gYX}f~5VID>dt;NuD?MzPbMT z?zY^^H{O1axy&`0VVVw3_b?4TUE{#}$YiFyes|fc+-K;}#%-%q!a?T{yI5^Qce%X{ zJ;cT;^a2p6IqcLo$xQ9PTiQsVJJ$(%^tjz_@l1q(6u{B@v--{3dt~<6&2|BXZPPGS zxT!3nBgroWDR!aPv|k~%WbSzMh_zFe(8;EH^tP(5)ph=l&spZHY z1p9szX3*1$EION!#;$hST=6&^VL_c^S8SWzVozZnAoCAU5M6PmPYSEd+4GVdXkKw8 zN)zw${p-b=N@Zr>VeHO-v2E?rm3%TmHc+3(86J{_g7Y{Y@FdYqbkCy<@VjW{LwF)& zhBd*e7`EZmP1mu?X2tbZZDNEtg9p)t0A#pz2+t;5oo9l>#WK>ZSQXU5n%z?=hJ=A( z&A#2gRhSmyr$3MYnLjYMsxjTRp`uU~uh^J@YumQD)hb?$ZJXt=oqU#S<0={ZVzaPS zwdy;;)#}`F)6ZrG9^UODZVk`bQ(US!#8uQcDV2^M`+MYHQnJ{V diff --git a/_freeze/windmill/figure-beamer/windmill-20-1.pdf b/_freeze/windmill/figure-beamer/windmill-20-1.pdf index 2ee17aaef192cd3f601b757cfbd774d373457d49..1fb176fd2ddef21cf03b592d9cf9d3aa2e000143 100644 GIT binary patch delta 1067 zcmZuwL2eT<6cy|+w3S$}p@=WkK)Y!EcxI9`Ra8WirmCQ&BrK3Z7S4>54ot?C$5REd zh;jl{MPk7fSoR<+xB*;%Bk-LzX-e?Mn&;>L{=E17efy99Aa`7=Z}Pm)a-(0P-=iO+ zpYJu}<2Or>pK{J!?sx^?*x~Vzv%_Q( zs?G=If&+H1Q~=+8I+cJ`VMMHYfXAXIQ}Bq;fa?pTg$tHv*;*#%ijGy482U_M%U<^Z z8!}ay4yd62PeIGL?114bne@yFxLa-+&Nt!0y?yWQdGc^L?d`H9d>Mr)w7|B~fHt+P zGLq(ihcb-Bt{Ongp|g_fK*90bbKP6(n_^Dp+@c+amVg zhYa@yX1{5y!{ijXL7K7B%~KIf5KJ5UyHL2|&-rU1E7-z=YIRqnGK8XKwWk5tuW0}; zVk328MX)B%qCncBcm!)6%&aMti-7gWGHH*AT$6zcC0u-4$+J5YYicOz{`lSUlUp$U zyj&eJ?)w-j6U#J>0DD@Tk%9;^D-=XJ$okz_4ggIQQz7h&K&u3>qopO%O%Vi?Cc`k2 zTBcD7m`{`mWfxFK3C&7C#>cUk!%woLCv?`2#r@0xs-8;ZM=aUzN1{*Kl)`vrd2Kis;XunSbAWT^%oY?21+M^Im|-r5$tff=j2CH^?YhQ1 zUS7o95@m9ecj9?lG^aN~&;O5z%jrek5+Wb~ delta 1748 zcmah~-HRhd5Wf}frFB6#xphIf;&8oPH0hp?OfpAU*nG_GdLO$aK>{I2XQq>#yU9%G z=~-7n@-MjL&+tj^Z}3475%EDp@a07C$u}RhdNwi126PBvQe9nDzhC{T@~8df!@}NK z!z&m?o9uo6KrT!<`0>DvHjNUZ0n8b&+or7JM31ie!Jg( z^TY3c`{A!|OP$F#zmr$5-Rk^$`wt@GAXQTEv3}D5t(Cx?PbUKC86OEk>q)FctWwaK zTZFbmnq<-!DVW!Wry>Y>ExCjqLqpkMV7pVhPw>9Pi%`nl4i6WJ4E()7aGj`oI(RO8 zMQA%4s64fo$T6Y%JNGa!Sf|-7dSN7<@v(sYBK;(cgK-!|9}m%((qTBtq$ms!k&tw{ zI4zhA$(sbjgLw!I>RC1(2nma*C-E?8guVjj8c=Ns#$-@p8p{&3CjLw&ep@K$AxRAn zXh&QsKrauuf@&4$v1dYAM?=`Od8r zzjc6>EIOhqUGInnveFLS1Y|3xo_Z#k?d-n0w-P{CuLJbxNxfd}rr`imm|ukk#KM_gv(h-Zo>qa+qDsL$mw223^S{guM=Di_d? zA|+(3`J)YS5&8lfgP_4$wxr}biy7N~`PKG)a=h6VJr;|Qb7kk6I2jwDwci5WfxLE=P%f7C_tKX95`@ z^z&Adpr&#u5~`OU81q$r(tuvIUUrVkN3~L=?lz2ivuWBD!*!YGx|ZAYm~{yM@6y*A TPZgIcr@qWe2HD$do_gdTX{qDd diff --git a/_freeze/windmill/figure-beamer/windmill-25-1.pdf b/_freeze/windmill/figure-beamer/windmill-25-1.pdf index cefed7659fdebf87f78feaa51aff457ed69cc5ed..2c357a5c95f2a70108a30d8e2a41ff2cee8d850b 100644 GIT binary patch delta 1283 zcmZWpe{54l9M6ae@e-y{gn%Ub1~($n_1=4ZZ7I$nZC64RwzR}WM}*_BHb4W`yBoE&0p77^fC5euL0pyx+(q)#hp;4MpuHVY z&sN0Pq6Lbl*qnOe79A&8_LJ(@Pju6D`zF6Qo~@qTb$DZ}miTlevA1i_%QHuozh|C3JbGjBnS-0o zPoFQHC^q?5(NrxT>iG6pbMMb+mYv!6+>%p6?+kT+#W(qtYUYEfGY^c1XBrOFKAZjU z&DRdDo%n|DIKHy!r4!>fZ`7)XIuCu9KfV6Xhw#L&*Z;cEjZfZeqW8yt{~>hcabxt- zPiJ2*kAME+wXyGi8TEj}a7RgO z$qH2v8NLiyYPyVP2Z$9Q*w1W9K;#x5-EM$_lwc3unoK5$Pi=@QR&Kr`>S=CAfH%8> za!-li6diOds)pk2&>V*U(~iWWfYXj*%5PVaQ`BNMg)#l!5V~6y&ljAMLgi}X+6JiH zcTcj6bkoE(6E5|A2XLN~L8(Bjq7t$kZWRlCE-e8Tjw=V@0yTkI9VQB$CdcsnV`J;`(`A2l{FuZyw9W?a;4^Z$! z)AXo3p9`^Y*p!vH12YZTtUItsIKCK*$qQj2Ps#>Zd4aGIUqp-=(M2NBh*7s0!HMHi v9$YqA=LIVN8Q`s6ACpB_wZs|51gI-1xN&?zxClImMh$%_YH8`{Or!q*GpC?I delta 1895 zcmah~TZkJ~817d3a@?xWi>%} ztXmcd2;z-C)M!ybVevtqD!2$1t1ShkYN=b@f?BbPU9Cl{R_!Wi>wmJDy>vl`5Sah` z*YE$nGmk4r?hLi}q%$EQ96{}4f_+;{!oU4BDJvy^+LGJXTbEtl~^~M?^x!qNUNsm@$h@@=GW0vP) zoVe+tH6)T2m?kIuLB_*Tm zJ1kUSaO_MUhC~?jlG`cF*req1ORH~jZ7xrYMJXDMw_HHA*C!8M7~3}T`P#=8ZCE~5eL)SqIr8ehjb7r^wS5CW zPMrKY@xXzD!+)K-c>egr^{4+{dH-v_z5md5rtJCnoddmB9olhto%%~M^vsbbdUn?* z-&p!$^u*Z6pM&?kyng)4@u3g>RqoH|(pBvh40WM``DfbA3Zeu{P6a1XT4kh zcFEySk1abWO}0FDet+VXXP^42?dVVS!>vmbDRT6Oi+`NjPTsw|iY!AKpa4AqDZC?ck1VCmX^U zeV!msx>Kp7=CUFdIG3~ib$3Nu3##v1k*Z-K5+Oy~1G2dWDLdLABbx4ejOd1=`<0T( zhKOgFMMf%`?${P7I1GFsMALOp0x25IVXonluw{EiRw9mJm5C1WF->jSIN)1l&G9Ry z=6l30+ZNkJbj?|4TlJkQZ-!_}n0-cy>VnRXcp z@*MLoh}qpjPeoq`wRV7rbF7cwcQh=@v&jJF;MK6L^xoUAuFX&CmGFj;qIHdbbQk+XqLsB$PE}ShTl{(Yw^9zaiJ!b!a_ulW1=EUAu+7ff;J(7 z_2JFNAj80DsT1$2YTkg$G(6ahRKijirkP>$ki$xdVnIT5`oW4UOENCuz$QunD}S&R z*c4TX1-4pX1Z9Cb<~mX;z&hvJl&A#P`&^qO%hL&ie3DA%6_(W4l{Gd{DLTKy2vuRV zbBid^*t~>FEF#no+;CG37@oClpcm&5e0umzjfLiCr#p@FaY2eEsi;x~>Zw$uG#!;B knWj~FgGkk6CV~IorJs}E^)$z8K(E50Pl?eKV8UY__f`-QA=FO^mx*mAEEvXJ0nc&dv*O z-lp3^Sr)5)1Y6_MAN$ddBIt)ui67D6PeJ@DErcr4QcPkAYfTVBRn%JV+wIy-GCwnO z=iGB<&OLXolC%4s2@EItJB^^F1VqD7;XvE8kE4Z|=Ey(?rH z9U2+r*#wmg+7tUt-LxJ&t32NlESZRi3q~au(4OqjdV4kIWfhnCKPQk^k54inaVn|H zb3le^j``4qfFwL<2ybanIE5C>llS2y&OM2@KJ=(|3rLdrydZ2Ov^EhcME$EY@)GlM zasmu1)B`h}Fl%nBZZG|O_tNdzpFVwVVdzxb?JrKB*|+!mxnJf#3%}EO@uTlP7O%V; zDW98PpI%*mp*lMH$({M_SB{+j;8vpJ2R4@(J@Cir&cTdt+}~t|B}Vz^ugKSjg?c&g~hfX+b@0od)vT`*FRkQ zYG_w1a_h|tQ+Ixgesk}{dUbJaamiS{IT83Pe|6`dtJhY)t*+d2o_yksqvZ0+VB z5gng}O&vnIm2R4Yvaw;?u;6xzNf;p*8&qILnbt@@&H$oO(r<#HNYoTd8tE&_Ln*1U z5{)W8)O5K>O;Wp7A%5~u3_|zuO-WHDB{)I`;_(>uSr)n#D&2^Zx~sntkb|yd!c!t7 z!KNIWDN-^7d%B=8WHS`$2GZ{+B%WOaCz#E%3}z2#L2U;H)R&mqeC2LS+rv#D&mNTXdd4Qr&IZ|WzXYHqb&+HuIXSHl}PK;CEdimR|j~Y)h=}1=*G3& zSTlM|+~rNRh>la+STl74)3&)5!hme7p=^z>v_aU6Y!R`-))tYFt~cSNppMG~{hG?w#juR@as6tHi$IW~q@irn9qmH`C6}EO%z| zsFX#Nf)>%Zv_A~k9}3kUf+haw^G~se;Gf9R7GK&X_@0y3mZsBZX(pEOgD_ z?V*;|OB|E|km5;%(`3X!;FScdP&f?rizvvlLEAVn;%w}7RENL`7l{C%hDCczs#Y~% zJGC*2I_E%Q{&&p{Pmq;PZX(=xM^pKizfW!W=%@Fjv*yb!vxg77-m&hRqgVcXKlqaW z!?!*;MxWjrdS(3hwSBYK_RI_n9J+q|wl7~j_}b-k`?uss)_U^B+f(OXcznl>wRdMn z`-k6I);O^8aMs%2d1CwCeTmAzeOK)_|2kIMGq$>L z4}NQT?!q%~Ts>;u8x74oduZr-!xJZO?!GoNd3EwmPg0to(iU-0bO@>6`kR z)qNIT@oO`VE}yzMb8z_l+4U!y3%31(j94-AN_ zoM?Webx{H~1C}6zyJNAaYLgri7^74Dl^0jFG;)=9SH;RmkY${+9H5-7;{sKO2v#-M zAz0I?<`(k?8NrTjbDyhz(O;j{A7a8zNe&}X_-6NFbIUWfT z$Im|~peT}p^2oD^62QtHWO_D5ltCCZTiG*$(&mlxHeP^n)*L;XA_;){Qk%$2b+Mul z4AuFG!CUi{p;x}%QBgo;OD|ERK%Ji=3yW+HRblN@_}C%btM4WZ8Jw~#U|p5E9A;}B zvHICZt2>S|;paoLm=u!1Xd)2}DP2-55fr)-30{^G$*yEfR3a$+zb^eu6t<&Mr#ccP N(8+VHt%+?(?q3c>OSS+2 diff --git a/_freeze/windmill/figure-beamer/windmill-5-1.pdf b/_freeze/windmill/figure-beamer/windmill-5-1.pdf index e071df29fa8b3ca005ca02db8b73e7ba65716788..98041b2b4ce5997658bf9be33cfcc92b117d5fe1 100644 GIT binary patch delta 1089 zcmZWoJ#Q015LME#h(r+|1r&@BMoEG9cJISUWTmhZM-e1MHli_>*xaq1gY#{)w}%Xk z<(dX`e}S4Nzk&i$&{IIqZ(!DO96P@5-oBlA`{vE>?XUjB((!KNDJy%VH2O38JNh~L z^;#1K4ycp2q*^Wh-M{yQF~*tW`tH^Sp@%Bk6-L7P?lyP0cXd{Lzf~S`WYo13Mrl}Y zZjhZFBGbs$;?tTyUw$}~K6ki=NEDMM4vspSSe|8TnVJcm)>UfoH-k-k z-2>W`naXvD1-)wpE#u-Zk>s6jL@vPUju)_pE1`$wqctd)ax~o$p`|=>Rh^S|1K0k z@p<*`ZJ=EQ^8m zw0Mux5MhpLX&CD;?{^b90BYhSLZ~l7tx}*TT3RCB6k&*?A~cGnmRXzuEvL#vvI|tl zDFz`#W0OS8;HP=o6FToF;#F>ds-8;aJ0yy6>C76_nek!l<>Z}{l#QLHt^CA{LuaFh zBRmp))P(LAwUx)inb8fj>=FkUBhK`L!1rArx-i8!ZixLLonkD&0MBDC_i!-RFqdNv z=dq#dc^HCu(Df<{1s%?Cjplg{-&()|7A!OgJU%1FXb~q;v>AI7_?(kcY41gY{0C8LCPDxJ delta 1738 zcmah~Uuzpj5RU_)uxTMsC<&!>66(foEA8IDl@x@*l6=9nlNd<^gK*o`-AcaXbSL)q zT&FMk3`Vbg>^I0~=tH5DQuQitWSUhA}-+;TnfBMSqvTKdzjg!u;&wqOT z%RfJQ-SH29kyqERb^pBaH<^C>_WKh;yD!EP=#dyoLYrx#Wuh}M_-#VlGD~w6$PDbc z;gJj@(MZps$Iwu*7`Qd}gkZSBIPhj(J3B-sp()S8_oB>sp5rI|XEM-)cJjV{F`i&* zKUE_#`=7a3h}PXZF8fg|AB&NMtup;OO2SbT$6pT6n9)Hr%#|$lB_6BG!;*&tjl;qA z0>HHNI3M+;f&z0t8KkW!(7@;IG$zYlYz7`Py)2tH>>jB!=tvDcFo+e%OHOf+OR9cym5GyIQr#%lgJw zH{UhXWm;it1&RFPy$?TToN=33w(VkjkJ7MZl5Dje*vxj9XBWNl0Yir-#_LqUR(l)E zD1c0vSEpf`C`N&kF#ID`GuE*$GCjES(dG((Dcu0{=zg==5Sa`C6@a~;OmE%3w?U@P z?dAk5*QH^qaZp)Ahf17DDuP@~8bm6{M}t_NQys;jq$3fiG@*SZ(Fa3B5TJ@^7)d3w zD5K>h)u9|v6(vI&p!DKcTpCaFWGGZVibbwzI!qJ!oCZQ&Pm}3ecRoN8c4IA7VtAr0 zc@_l{*~jLRUBw8UZXT=U3_wLvXoMZx%U~nj}HH-wxvr~iSZcKKz$Ksc#q5%IFIALND@;- z_cY1?fAeBKgQrqum=m0`{MI%rRk3WxYbDR>9F;O~Na+H9%f070dT6m+e6Pe_c+@ VQe;{vJsSyrBy6&|x%b2;{{mzo+uHyD diff --git a/_freeze/windmill/libs/revealjs/dist/theme/quarto.css b/_freeze/windmill/libs/revealjs/dist/theme/quarto.css index 2577a64..58f87c5 100644 --- a/_freeze/windmill/libs/revealjs/dist/theme/quarto.css +++ b/_freeze/windmill/libs/revealjs/dist/theme/quarto.css @@ -1,8 +1,8 @@ -@import"./fonts/source-sans-pro/source-sans-pro.css";:root{--r-background-color: #fff;--r-main-font: Source Sans Pro, Helvetica, sans-serif;--r-main-font-size: 40px;--r-main-color: #222;--r-block-margin: 12px;--r-heading-margin: 0 0 12px 0;--r-heading-font: Source Sans Pro, Helvetica, sans-serif;--r-heading-color: #222;--r-heading-line-height: 1.2;--r-heading-letter-spacing: normal;--r-heading-text-transform: none;--r-heading-text-shadow: none;--r-heading-font-weight: 600;--r-heading1-text-shadow: none;--r-heading1-size: 2.5em;--r-heading2-size: 1.6em;--r-heading3-size: 1.3em;--r-heading4-size: 1em;--r-code-font: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;--r-link-color: #2a76dd;--r-link-color-dark: #1a53a1;--r-link-color-hover: #5692e4;--r-selection-background-color: #98bdef;--r-selection-color: #fff}.reveal-viewport{background:#fff;background-color:var(--r-background-color)}.reveal{font-family:var(--r-main-font);font-size:var(--r-main-font-size);font-weight:normal;color:var(--r-main-color)}.reveal ::selection{color:var(--r-selection-color);background:var(--r-selection-background-color);text-shadow:none}.reveal ::-moz-selection{color:var(--r-selection-color);background:var(--r-selection-background-color);text-shadow:none}.reveal .slides section,.reveal .slides section>section{line-height:1.3;font-weight:inherit}.reveal h1,.reveal h2,.reveal h3,.reveal h4,.reveal h5,.reveal h6{margin:var(--r-heading-margin);color:var(--r-heading-color);font-family:var(--r-heading-font);font-weight:var(--r-heading-font-weight);line-height:var(--r-heading-line-height);letter-spacing:var(--r-heading-letter-spacing);text-transform:var(--r-heading-text-transform);text-shadow:var(--r-heading-text-shadow);word-wrap:break-word}.reveal h1{font-size:var(--r-heading1-size)}.reveal h2{font-size:var(--r-heading2-size)}.reveal h3{font-size:var(--r-heading3-size)}.reveal h4{font-size:var(--r-heading4-size)}.reveal h1{text-shadow:var(--r-heading1-text-shadow)}.reveal p{margin:var(--r-block-margin) 0;line-height:1.3}.reveal h1:last-child,.reveal h2:last-child,.reveal h3:last-child,.reveal h4:last-child,.reveal h5:last-child,.reveal h6:last-child{margin-bottom:0}.reveal img,.reveal video,.reveal iframe{max-width:95%;max-height:95%}.reveal strong,.reveal b{font-weight:bold}.reveal em{font-style:italic}.reveal ol,.reveal dl,.reveal ul{display:inline-block;text-align:left;margin:0 0 0 1em}.reveal ol{list-style-type:decimal}.reveal ul{list-style-type:disc}.reveal ul ul{list-style-type:square}.reveal ul ul ul{list-style-type:circle}.reveal ul ul,.reveal ul ol,.reveal ol ol,.reveal ol ul{display:block;margin-left:40px}.reveal dt{font-weight:bold}.reveal dd{margin-left:40px}.reveal blockquote{display:block;position:relative;width:70%;margin:var(--r-block-margin) auto;padding:5px;font-style:italic;background:rgba(255,255,255,.05);box-shadow:0px 0px 2px rgba(0,0,0,.2)}.reveal blockquote p:first-child,.reveal blockquote p:last-child{display:inline-block}.reveal q{font-style:italic}.reveal pre{display:block;position:relative;width:90%;margin:var(--r-block-margin) auto;text-align:left;font-size:.55em;font-family:var(--r-code-font);line-height:1.2em;word-wrap:break-word;box-shadow:0px 5px 15px rgba(0,0,0,.15)}.reveal code{font-family:var(--r-code-font);text-transform:none;tab-size:2}.reveal pre code{display:block;padding:5px;overflow:auto;max-height:400px;word-wrap:normal}.reveal .code-wrapper{white-space:normal}.reveal .code-wrapper code{white-space:pre}.reveal table{margin:auto;border-collapse:collapse;border-spacing:0}.reveal table th{font-weight:bold}.reveal table th,.reveal table td{text-align:left;padding:.2em .5em .2em .5em;border-bottom:1px solid}.reveal table th[align=center],.reveal table td[align=center]{text-align:center}.reveal table th[align=right],.reveal table td[align=right]{text-align:right}.reveal table tbody tr:last-child th,.reveal table tbody tr:last-child td{border-bottom:none}.reveal sup{vertical-align:super;font-size:smaller}.reveal sub{vertical-align:sub;font-size:smaller}.reveal small{display:inline-block;font-size:.6em;line-height:1.2em;vertical-align:top}.reveal small *{vertical-align:top}.reveal img{margin:var(--r-block-margin) 0}.reveal a{color:var(--r-link-color);text-decoration:none;transition:color .15s ease}.reveal a:hover{color:var(--r-link-color-hover);text-shadow:none;border:none}.reveal .roll span:after{color:#fff;background:var(--r-link-color-dark)}.reveal .r-frame{border:4px solid var(--r-main-color);box-shadow:0 0 10px rgba(0,0,0,.15)}.reveal a .r-frame{transition:all .15s linear}.reveal a:hover .r-frame{border-color:var(--r-link-color);box-shadow:0 0 20px rgba(0,0,0,.55)}.reveal .controls{color:var(--r-link-color)}.reveal .progress{background:rgba(0,0,0,.2);color:var(--r-link-color)}@media print{.backgrounds{background-color:var(--r-background-color)}}.top-right{position:absolute;top:1em;right:1em}.visually-hidden{border:0;clip:rect(0 0 0 0);height:auto;margin:0;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none !important}.zindex-bottom{z-index:-1 !important}figure.figure{display:block}.quarto-layout-panel{margin-bottom:1em}.quarto-layout-panel>figure{width:100%}.quarto-layout-panel>figure>figcaption,.quarto-layout-panel>.panel-caption{margin-top:10pt}.quarto-layout-panel>.table-caption{margin-top:0px}.table-caption p{margin-bottom:.5em}.quarto-layout-row{display:flex;flex-direction:row;align-items:flex-start}.quarto-layout-valign-top{align-items:flex-start}.quarto-layout-valign-bottom{align-items:flex-end}.quarto-layout-valign-center{align-items:center}.quarto-layout-cell{position:relative;margin-right:20px}.quarto-layout-cell:last-child{margin-right:0}.quarto-layout-cell figure,.quarto-layout-cell>p{margin:.2em}.quarto-layout-cell img{max-width:100%}.quarto-layout-cell .html-widget{width:100% !important}.quarto-layout-cell div figure p{margin:0}.quarto-layout-cell figure{display:block;margin-inline-start:0;margin-inline-end:0}.quarto-layout-cell table{display:inline-table}.quarto-layout-cell-subref figcaption,figure .quarto-layout-row figure figcaption{text-align:center;font-style:italic}.quarto-figure{position:relative;margin-bottom:1em}.quarto-figure>figure{width:100%;margin-bottom:0}.quarto-figure-left>figure>p,.quarto-figure-left>figure>div{text-align:left}.quarto-figure-center>figure>p,.quarto-figure-center>figure>div{text-align:center}.quarto-figure-right>figure>p,.quarto-figure-right>figure>div{text-align:right}.quarto-figure>figure>div.cell-annotation,.quarto-figure>figure>div code{text-align:left}figure>p:empty{display:none}figure>p:first-child{margin-top:0;margin-bottom:0}figure>figcaption.quarto-float-caption-bottom{margin-bottom:.5em}figure>figcaption.quarto-float-caption-top{margin-top:.5em}div[id^=tbl-]{position:relative}.quarto-figure>.anchorjs-link{position:absolute;top:.6em;right:.5em}div[id^=tbl-]>.anchorjs-link{position:absolute;top:.7em;right:.3em}.quarto-figure:hover>.anchorjs-link,div[id^=tbl-]:hover>.anchorjs-link,h2:hover>.anchorjs-link,h3:hover>.anchorjs-link,h4:hover>.anchorjs-link,h5:hover>.anchorjs-link,h6:hover>.anchorjs-link,.reveal-anchorjs-link>.anchorjs-link{opacity:1}#title-block-header{margin-block-end:1rem;position:relative;margin-top:-1px}#title-block-header .abstract{margin-block-start:1rem}#title-block-header .abstract .abstract-title{font-weight:600}#title-block-header a{text-decoration:none}#title-block-header .author,#title-block-header .date,#title-block-header .doi{margin-block-end:.2rem}#title-block-header .quarto-title-block>div{display:flex}#title-block-header .quarto-title-block>div>h1{flex-grow:1}#title-block-header .quarto-title-block>div>button{flex-shrink:0;height:2.25rem;margin-top:0}tr.header>th>p:last-of-type{margin-bottom:0px}table,table.table{margin-top:.5rem;margin-bottom:.5rem}caption,.table-caption{padding-top:.5rem;padding-bottom:.5rem;text-align:center}figure.quarto-float-tbl figcaption.quarto-float-caption-top{margin-top:.5rem;margin-bottom:.25rem;text-align:center}figure.quarto-float-tbl figcaption.quarto-float-caption-bottom{padding-top:.25rem;margin-bottom:.5rem;text-align:center}.utterances{max-width:none;margin-left:-8px}iframe{margin-bottom:1em}details{margin-bottom:1em}details[show]{margin-bottom:0}details>summary{color:#6f6f6f}details>summary>p:only-child{display:inline}pre.sourceCode,code.sourceCode{position:relative}p code:not(.sourceCode){white-space:pre-wrap}code{white-space:pre}@media print{code{white-space:pre-wrap}}pre>code{display:block}pre>code.sourceCode{white-space:pre}pre>code.sourceCode>span>a:first-child::before{text-decoration:none}pre.code-overflow-wrap>code.sourceCode{white-space:pre-wrap}pre.code-overflow-scroll>code.sourceCode{white-space:pre}code a:any-link{color:inherit;text-decoration:none}code a:hover{color:inherit;text-decoration:underline}ul.task-list{padding-left:1em}[data-tippy-root]{display:inline-block}.tippy-content .footnote-back{display:none}.footnote-back{margin-left:.2em}.tippy-content{overflow-x:auto}.quarto-embedded-source-code{display:none}.quarto-unresolved-ref{font-weight:600}.quarto-cover-image{max-width:35%;float:right;margin-left:30px}.cell-output-display .widget-subarea{margin-bottom:1em}.cell-output-display:not(.no-overflow-x),.knitsql-table:not(.no-overflow-x){overflow-x:auto}.panel-input{margin-bottom:1em}.panel-input>div,.panel-input>div>div{display:inline-block;vertical-align:top;padding-right:12px}.panel-input>p:last-child{margin-bottom:0}.layout-sidebar{margin-bottom:1em}.layout-sidebar .tab-content{border:none}.tab-content>.page-columns.active{display:grid}div.sourceCode>iframe{width:100%;height:300px;margin-bottom:-0.5em}a{text-underline-offset:3px}div.ansi-escaped-output{font-family:monospace;display:block}/*! +@import"./fonts/source-sans-pro/source-sans-pro.css";:root{--r-background-color: #fff;--r-main-font: Source Sans Pro, Helvetica, sans-serif;--r-main-font-size: 40px;--r-main-color: #222;--r-block-margin: 12px;--r-heading-margin: 0 0 12px 0;--r-heading-font: Source Sans Pro, Helvetica, sans-serif;--r-heading-color: #222;--r-heading-line-height: 1.2;--r-heading-letter-spacing: normal;--r-heading-text-transform: none;--r-heading-text-shadow: none;--r-heading-font-weight: 600;--r-heading1-text-shadow: none;--r-heading1-size: 2.5em;--r-heading2-size: 1.6em;--r-heading3-size: 1.3em;--r-heading4-size: 1em;--r-code-font: SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;--r-link-color: #2a76dd;--r-link-color-dark: #1a53a1;--r-link-color-hover: #5692e4;--r-selection-background-color: #98bdef;--r-selection-color: #fff}.reveal-viewport{background:#fff;background-color:var(--r-background-color)}.reveal{font-family:var(--r-main-font);font-size:var(--r-main-font-size);font-weight:normal;color:var(--r-main-color)}.reveal ::selection{color:var(--r-selection-color);background:var(--r-selection-background-color);text-shadow:none}.reveal ::-moz-selection{color:var(--r-selection-color);background:var(--r-selection-background-color);text-shadow:none}.reveal .slides section,.reveal .slides section>section{line-height:1.3;font-weight:inherit}.reveal h1,.reveal h2,.reveal h3,.reveal h4,.reveal h5,.reveal h6{margin:var(--r-heading-margin);color:var(--r-heading-color);font-family:var(--r-heading-font);font-weight:var(--r-heading-font-weight);line-height:var(--r-heading-line-height);letter-spacing:var(--r-heading-letter-spacing);text-transform:var(--r-heading-text-transform);text-shadow:var(--r-heading-text-shadow);word-wrap:break-word}.reveal h1{font-size:var(--r-heading1-size)}.reveal h2{font-size:var(--r-heading2-size)}.reveal h3{font-size:var(--r-heading3-size)}.reveal h4{font-size:var(--r-heading4-size)}.reveal h1{text-shadow:var(--r-heading1-text-shadow)}.reveal p{margin:var(--r-block-margin) 0;line-height:1.3}.reveal h1:last-child,.reveal h2:last-child,.reveal h3:last-child,.reveal h4:last-child,.reveal h5:last-child,.reveal h6:last-child{margin-bottom:0}.reveal img,.reveal video,.reveal iframe{max-width:95%;max-height:95%}.reveal strong,.reveal b{font-weight:bold}.reveal em{font-style:italic}.reveal ol,.reveal dl,.reveal ul{display:inline-block;text-align:left;margin:0 0 0 1em}.reveal ol{list-style-type:decimal}.reveal ul{list-style-type:disc}.reveal ul ul{list-style-type:square}.reveal ul ul ul{list-style-type:circle}.reveal ul ul,.reveal ul ol,.reveal ol ol,.reveal ol ul{display:block;margin-left:40px}.reveal dt{font-weight:bold}.reveal dd{margin-left:40px}.reveal blockquote{display:block;position:relative;width:70%;margin:var(--r-block-margin) auto;padding:5px;font-style:italic;background:rgba(255,255,255,.05);box-shadow:0px 0px 2px rgba(0,0,0,.2)}.reveal blockquote p:first-child,.reveal blockquote p:last-child{display:inline-block}.reveal q{font-style:italic}.reveal pre{display:block;position:relative;width:90%;margin:var(--r-block-margin) auto;text-align:left;font-size:.55em;font-family:var(--r-code-font);line-height:1.2em;word-wrap:break-word;box-shadow:0px 5px 15px rgba(0,0,0,.15)}.reveal code{font-family:var(--r-code-font);text-transform:none;tab-size:2}.reveal pre code{display:block;padding:5px;overflow:auto;max-height:400px;word-wrap:normal}.reveal .code-wrapper{white-space:normal}.reveal .code-wrapper code{white-space:pre}.reveal table{margin:auto;border-collapse:collapse;border-spacing:0}.reveal table th{font-weight:bold}.reveal table th,.reveal table td{text-align:left;padding:.2em .5em .2em .5em;border-bottom:1px solid}.reveal table th[align=center],.reveal table td[align=center]{text-align:center}.reveal table th[align=right],.reveal table td[align=right]{text-align:right}.reveal table tbody tr:last-child th,.reveal table tbody tr:last-child td{border-bottom:none}.reveal sup{vertical-align:super;font-size:smaller}.reveal sub{vertical-align:sub;font-size:smaller}.reveal small{display:inline-block;font-size:.6em;line-height:1.2em;vertical-align:top}.reveal small *{vertical-align:top}.reveal img{margin:var(--r-block-margin) 0}.reveal a{color:var(--r-link-color);text-decoration:none;transition:color .15s ease}.reveal a:hover{color:var(--r-link-color-hover);text-shadow:none;border:none}.reveal .roll span:after{color:#fff;background:var(--r-link-color-dark)}.reveal .r-frame{border:4px solid var(--r-main-color);box-shadow:0 0 10px rgba(0,0,0,.15)}.reveal a .r-frame{transition:all .15s linear}.reveal a:hover .r-frame{border-color:var(--r-link-color);box-shadow:0 0 20px rgba(0,0,0,.55)}.reveal .controls{color:var(--r-link-color)}.reveal .progress{background:rgba(0,0,0,.2);color:var(--r-link-color)}@media print{.backgrounds{background-color:var(--r-background-color)}}.top-right{position:absolute;top:1em;right:1em}.visually-hidden{border:0;clip:rect(0 0 0 0);height:auto;margin:0;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none !important}.zindex-bottom{z-index:-1 !important}figure.figure{display:block}.quarto-layout-panel{margin-bottom:1em}.quarto-layout-panel>figure{width:100%}.quarto-layout-panel>figure>figcaption,.quarto-layout-panel>.panel-caption{margin-top:10pt}.quarto-layout-panel>.table-caption{margin-top:0px}.table-caption p{margin-bottom:.5em}.quarto-layout-row{display:flex;flex-direction:row;align-items:flex-start}.quarto-layout-valign-top{align-items:flex-start}.quarto-layout-valign-bottom{align-items:flex-end}.quarto-layout-valign-center{align-items:center}.quarto-layout-cell{position:relative;margin-right:20px}.quarto-layout-cell:last-child{margin-right:0}.quarto-layout-cell figure,.quarto-layout-cell>p{margin:.2em}.quarto-layout-cell img{max-width:100%}.quarto-layout-cell .html-widget{width:100% !important}.quarto-layout-cell div figure p{margin:0}.quarto-layout-cell figure{display:block;margin-inline-start:0;margin-inline-end:0}.quarto-layout-cell table{display:inline-table}.quarto-layout-cell-subref figcaption,figure .quarto-layout-row figure figcaption{text-align:center;font-style:italic}.quarto-figure{position:relative;margin-bottom:1em}.quarto-figure>figure{width:100%;margin-bottom:0}.quarto-figure-left>figure>p,.quarto-figure-left>figure>div{text-align:left}.quarto-figure-center>figure>p,.quarto-figure-center>figure>div{text-align:center}.quarto-figure-right>figure>p,.quarto-figure-right>figure>div{text-align:right}.quarto-figure>figure>div.cell-annotation,.quarto-figure>figure>div code{text-align:left}figure>p:empty{display:none}figure>p:first-child{margin-top:0;margin-bottom:0}figure>figcaption.quarto-float-caption-bottom{margin-bottom:.5em}figure>figcaption.quarto-float-caption-top{margin-top:.5em}div[id^=tbl-]{position:relative}.quarto-figure>.anchorjs-link{position:absolute;top:.6em;right:.5em}div[id^=tbl-]>.anchorjs-link{position:absolute;top:.7em;right:.3em}.quarto-figure:hover>.anchorjs-link,div[id^=tbl-]:hover>.anchorjs-link,h2:hover>.anchorjs-link,h3:hover>.anchorjs-link,h4:hover>.anchorjs-link,h5:hover>.anchorjs-link,h6:hover>.anchorjs-link,.reveal-anchorjs-link>.anchorjs-link{opacity:1}#title-block-header{margin-block-end:1rem;position:relative;margin-top:-1px}#title-block-header .abstract{margin-block-start:1rem}#title-block-header .abstract .abstract-title{font-weight:600}#title-block-header a{text-decoration:none}#title-block-header .author,#title-block-header .date,#title-block-header .doi{margin-block-end:.2rem}#title-block-header .quarto-title-block>div{display:flex}#title-block-header .quarto-title-block>div>h1{flex-grow:1}#title-block-header .quarto-title-block>div>button{flex-shrink:0;height:2.25rem;margin-top:0}tr.header>th>p:last-of-type{margin-bottom:0px}table,table.table{margin-top:.5rem;margin-bottom:.5rem}caption,.table-caption{padding-top:.5rem;padding-bottom:.5rem;text-align:center}figure.quarto-float-tbl figcaption.quarto-float-caption-top{margin-top:.5rem;margin-bottom:.25rem;text-align:center}figure.quarto-float-tbl figcaption.quarto-float-caption-bottom{padding-top:.25rem;margin-bottom:.5rem;text-align:center}.utterances{max-width:none;margin-left:-8px}iframe{margin-bottom:1em}details{margin-bottom:1em}details[show]{margin-bottom:0}details>summary{color:#6f6f6f}details>summary>p:only-child{display:inline}pre.sourceCode,code.sourceCode{position:relative}dd code:not(.sourceCode),p code:not(.sourceCode){white-space:pre-wrap}code{white-space:pre}@media print{code{white-space:pre-wrap}}pre>code{display:block}pre>code.sourceCode{white-space:pre}pre>code.sourceCode>span>a:first-child::before{text-decoration:none}pre.code-overflow-wrap>code.sourceCode{white-space:pre-wrap}pre.code-overflow-scroll>code.sourceCode{white-space:pre}code a:any-link{color:inherit;text-decoration:none}code a:hover{color:inherit;text-decoration:underline}ul.task-list{padding-left:1em}[data-tippy-root]{display:inline-block}.tippy-content .footnote-back{display:none}.footnote-back{margin-left:.2em}.tippy-content{overflow-x:auto}.quarto-embedded-source-code{display:none}.quarto-unresolved-ref{font-weight:600}.quarto-cover-image{max-width:35%;float:right;margin-left:30px}.cell-output-display .widget-subarea{margin-bottom:1em}.cell-output-display:not(.no-overflow-x),.knitsql-table:not(.no-overflow-x){overflow-x:auto}.panel-input{margin-bottom:1em}.panel-input>div,.panel-input>div>div{display:inline-block;vertical-align:top;padding-right:12px}.panel-input>p:last-child{margin-bottom:0}.layout-sidebar{margin-bottom:1em}.layout-sidebar .tab-content{border:none}.tab-content>.page-columns.active{display:grid}div.sourceCode>iframe{width:100%;height:300px;margin-bottom:-0.5em}a{text-underline-offset:3px}div.ansi-escaped-output{font-family:monospace;display:block}/*! * * ansi colors from IPython notebook's * * we also add `bright-[color]-` synonyms for the `-[color]-intense` classes since * that seems to be what ansi_up emits * -*/.ansi-black-fg{color:#3e424d}.ansi-black-bg{background-color:#3e424d}.ansi-black-intense-black,.ansi-bright-black-fg{color:#282c36}.ansi-black-intense-black,.ansi-bright-black-bg{background-color:#282c36}.ansi-red-fg{color:#e75c58}.ansi-red-bg{background-color:#e75c58}.ansi-red-intense-red,.ansi-bright-red-fg{color:#b22b31}.ansi-red-intense-red,.ansi-bright-red-bg{background-color:#b22b31}.ansi-green-fg{color:#00a250}.ansi-green-bg{background-color:#00a250}.ansi-green-intense-green,.ansi-bright-green-fg{color:#007427}.ansi-green-intense-green,.ansi-bright-green-bg{background-color:#007427}.ansi-yellow-fg{color:#ddb62b}.ansi-yellow-bg{background-color:#ddb62b}.ansi-yellow-intense-yellow,.ansi-bright-yellow-fg{color:#b27d12}.ansi-yellow-intense-yellow,.ansi-bright-yellow-bg{background-color:#b27d12}.ansi-blue-fg{color:#208ffb}.ansi-blue-bg{background-color:#208ffb}.ansi-blue-intense-blue,.ansi-bright-blue-fg{color:#0065ca}.ansi-blue-intense-blue,.ansi-bright-blue-bg{background-color:#0065ca}.ansi-magenta-fg{color:#d160c4}.ansi-magenta-bg{background-color:#d160c4}.ansi-magenta-intense-magenta,.ansi-bright-magenta-fg{color:#a03196}.ansi-magenta-intense-magenta,.ansi-bright-magenta-bg{background-color:#a03196}.ansi-cyan-fg{color:#60c6c8}.ansi-cyan-bg{background-color:#60c6c8}.ansi-cyan-intense-cyan,.ansi-bright-cyan-fg{color:#258f8f}.ansi-cyan-intense-cyan,.ansi-bright-cyan-bg{background-color:#258f8f}.ansi-white-fg{color:#c5c1b4}.ansi-white-bg{background-color:#c5c1b4}.ansi-white-intense-white,.ansi-bright-white-fg{color:#a1a6b2}.ansi-white-intense-white,.ansi-bright-white-bg{background-color:#a1a6b2}.ansi-default-inverse-fg{color:#fff}.ansi-default-inverse-bg{background-color:#000}.ansi-bold{font-weight:bold}.ansi-underline{text-decoration:underline}:root{--quarto-body-bg: #fff;--quarto-body-color: #222;--quarto-text-muted: #6f6f6f;--quarto-border-color: #bbbbbb;--quarto-border-width: 1px;--quarto-border-radius: 4px}table.gt_table{color:var(--quarto-body-color);font-size:1em;width:100%;background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_column_spanner_outer{color:var(--quarto-body-color);background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_col_heading{color:var(--quarto-body-color);font-weight:bold;background-color:rgba(0,0,0,0)}table.gt_table thead.gt_col_headings{border-bottom:1px solid currentColor;border-top-width:inherit;border-top-color:var(--quarto-border-color)}table.gt_table thead.gt_col_headings:not(:first-child){border-top-width:1px;border-top-color:var(--quarto-border-color)}table.gt_table td.gt_row{border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-width:0px}table.gt_table tbody.gt_table_body{border-top-width:1px;border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-color:currentColor}div.columns{display:initial;gap:initial}div.column{display:inline-block;overflow-x:initial;vertical-align:top;width:50%}.code-annotation-tip-content{word-wrap:break-word}.code-annotation-container-hidden{display:none !important}dl.code-annotation-container-grid{display:grid;grid-template-columns:min-content auto}dl.code-annotation-container-grid dt{grid-column:1}dl.code-annotation-container-grid dd{grid-column:2}pre.sourceCode.code-annotation-code{padding-right:0}code.sourceCode .code-annotation-anchor{z-index:100;position:relative;float:right;background-color:rgba(0,0,0,0)}input[type=checkbox]{margin-right:.5ch}:root{--mermaid-bg-color: #fff;--mermaid-edge-color: #999;--mermaid-node-fg-color: #222;--mermaid-fg-color: #222;--mermaid-fg-color--lighter: #3c3c3c;--mermaid-fg-color--lightest: #555555;--mermaid-font-family: Source Sans Pro, Helvetica, sans-serif;--mermaid-label-bg-color: #fff;--mermaid-label-fg-color: #468;--mermaid-node-bg-color: rgba(68, 102, 136, 0.1);--mermaid-node-fg-color: #222}@media print{:root{font-size:11pt}#quarto-sidebar,#TOC,.nav-page{display:none}.page-columns .content{grid-column-start:page-start}.fixed-top{position:relative}.panel-caption,.figure-caption,figcaption{color:#666}}.code-copy-button{position:absolute;top:0;right:0;border:0;margin-top:5px;margin-right:5px;background-color:rgba(0,0,0,0);z-index:3}.code-copy-button:focus{outline:none}.code-copy-button-tooltip{font-size:.75em}pre.sourceCode:hover>.code-copy-button>.bi::before{display:inline-block;height:1rem;width:1rem;content:"";vertical-align:-0.125em;background-image:url('data:image/svg+xml,');background-repeat:no-repeat;background-size:1rem 1rem}pre.sourceCode:hover>.code-copy-button-checked>.bi::before{background-image:url('data:image/svg+xml,')}pre.sourceCode:hover>.code-copy-button:hover>.bi::before{background-image:url('data:image/svg+xml,')}pre.sourceCode:hover>.code-copy-button-checked:hover>.bi::before{background-image:url('data:image/svg+xml,')}.panel-tabset [role=tablist]{border-bottom:1px solid #bbb;list-style:none;margin:0;padding:0;width:100%}.panel-tabset [role=tablist] *{-webkit-box-sizing:border-box;box-sizing:border-box}@media(min-width: 30em){.panel-tabset [role=tablist] li{display:inline-block}}.panel-tabset [role=tab]{border:1px solid rgba(0,0,0,0);border-top-color:#bbb;display:block;padding:.5em 1em;text-decoration:none}@media(min-width: 30em){.panel-tabset [role=tab]{border-top-color:rgba(0,0,0,0);display:inline-block;margin-bottom:-1px}}.panel-tabset [role=tab][aria-selected=true]{background-color:#bbb}@media(min-width: 30em){.panel-tabset [role=tab][aria-selected=true]{background-color:rgba(0,0,0,0);border:1px solid #bbb;border-bottom-color:#fff}}@media(min-width: 30em){.panel-tabset [role=tab]:hover:not([aria-selected=true]){border:1px solid #bbb}}.code-with-filename .code-with-filename-file{margin-bottom:0;padding-bottom:2px;padding-top:2px;padding-left:.7em;border:var(--quarto-border-width) solid var(--quarto-border-color);border-radius:var(--quarto-border-radius);border-bottom:0;border-bottom-left-radius:0%;border-bottom-right-radius:0%}.code-with-filename div.sourceCode,.reveal .code-with-filename div.sourceCode{margin-top:0;border-top-left-radius:0%;border-top-right-radius:0%}.code-with-filename .code-with-filename-file pre{margin-bottom:0}.code-with-filename .code-with-filename-file{background-color:rgba(219,219,219,.8)}.quarto-dark .code-with-filename .code-with-filename-file{background-color:#555}.code-with-filename .code-with-filename-file strong{font-weight:400}.reveal.center .slide aside,.reveal.center .slide div.aside{position:initial}section.has-light-background,section.has-light-background h1,section.has-light-background h2,section.has-light-background h3,section.has-light-background h4,section.has-light-background h5,section.has-light-background h6{color:#222}section.has-light-background a,section.has-light-background a:hover{color:#2a76dd}section.has-light-background code{color:#4758ab}section.has-dark-background,section.has-dark-background h1,section.has-dark-background h2,section.has-dark-background h3,section.has-dark-background h4,section.has-dark-background h5,section.has-dark-background h6{color:#fff}section.has-dark-background a,section.has-dark-background a:hover{color:#42affa}section.has-dark-background code{color:#ffa07a}#title-slide,div.reveal div.slides section.quarto-title-block{text-align:center}#title-slide .subtitle,div.reveal div.slides section.quarto-title-block .subtitle{margin-bottom:2.5rem}.reveal .slides{text-align:left}.reveal .title-slide h1{font-size:1.6em}.reveal[data-navigation-mode=linear] .title-slide h1{font-size:2.5em}.reveal div.sourceCode{border:1px solid #bbb;border-radius:4px}.reveal pre{width:100%;box-shadow:none;background-color:#fff;border:none;margin:0;font-size:.55em}.reveal code{color:var(--quarto-hl-fu-color);background-color:rgba(0,0,0,0);white-space:pre-wrap}.reveal pre.sourceCode code{background-color:#fff;padding:6px 9px;max-height:500px;white-space:pre}.reveal pre code{background-color:#fff;color:#222}.reveal .column-output-location{display:flex;align-items:stretch}.reveal .column-output-location .column:first-of-type div.sourceCode{height:100%;background-color:#fff}.reveal blockquote{display:block;position:relative;color:#6f6f6f;width:unset;margin:var(--r-block-margin) auto;padding:.625rem 1.75rem;border-left:.25rem solid #6f6f6f;font-style:normal;background:none;box-shadow:none}.reveal blockquote p:first-child,.reveal blockquote p:last-child{display:block}.reveal .slide aside,.reveal .slide div.aside{position:absolute;bottom:20px;font-size:0.7em;color:#6f6f6f}.reveal .slide sup{font-size:0.7em}.reveal .slide.scrollable aside,.reveal .slide.scrollable div.aside{position:relative;margin-top:1em}.reveal .slide aside .aside-footnotes{margin-bottom:0}.reveal .slide aside .aside-footnotes li:first-of-type{margin-top:0}.reveal .layout-sidebar{display:flex;width:100%;margin-top:.8em}.reveal .layout-sidebar .panel-sidebar{width:270px}.reveal .layout-sidebar-left .panel-sidebar{margin-right:calc(0.5em*2)}.reveal .layout-sidebar-right .panel-sidebar{margin-left:calc(0.5em*2)}.reveal .layout-sidebar .panel-fill,.reveal .layout-sidebar .panel-center,.reveal .layout-sidebar .panel-tabset{flex:1}.reveal .panel-input,.reveal .panel-sidebar{font-size:.5em;padding:.5em;border-style:solid;border-color:#bbb;border-width:1px;border-radius:4px;background-color:#f8f9fa}.reveal .panel-sidebar :first-child,.reveal .panel-fill :first-child{margin-top:0}.reveal .panel-sidebar :last-child,.reveal .panel-fill :last-child{margin-bottom:0}.panel-input>div,.panel-input>div>div{vertical-align:middle;padding-right:1em}.reveal p,.reveal .slides section,.reveal .slides section>section{line-height:1.3}.reveal.smaller .slides section,.reveal .slides section.smaller,.reveal .slides section .callout{font-size:0.7em}.reveal.smaller .slides section section{font-size:inherit}.reveal.smaller .slides h1,.reveal .slides section.smaller h1{font-size:calc(2.5em/0.7)}.reveal.smaller .slides h2,.reveal .slides section.smaller h2{font-size:calc(1.6em/0.7)}.reveal.smaller .slides h3,.reveal .slides section.smaller h3{font-size:calc(1.3em/0.7)}.reveal .columns>.column>:not(ul,ol){margin-left:.25em;margin-right:.25em}.reveal .columns>.column:first-child>:not(ul,ol){margin-right:.5em;margin-left:0}.reveal .columns>.column:last-child>:not(ul,ol){margin-right:0;margin-left:.5em}.reveal .slide-number{color:#5692e4;background-color:#fff}.reveal .footer{color:#6f6f6f}.reveal .footer a{color:#2a76dd}.reveal .footer.has-dark-background{color:#fff}.reveal .footer.has-dark-background a{color:#7bc6fa}.reveal .footer.has-light-background{color:#505050}.reveal .footer.has-light-background a{color:#6a9bdd}.reveal .slide-number{color:#6f6f6f}.reveal .slide-number.has-dark-background{color:#fff}.reveal .slide-number.has-light-background{color:#505050}.reveal .slide figure>figcaption,.reveal .slide img.stretch+p.caption,.reveal .slide img.r-stretch+p.caption{font-size:0.7em}@media screen and (min-width: 500px){.reveal .controls[data-controls-layout=edges] .navigate-left{left:.2em}.reveal .controls[data-controls-layout=edges] .navigate-right{right:.2em}.reveal .controls[data-controls-layout=edges] .navigate-up{top:.4em}.reveal .controls[data-controls-layout=edges] .navigate-down{bottom:2.3em}}.tippy-box[data-theme~=light-border]{background-color:#fff;color:#222;border-radius:4px;border:solid 1px #6f6f6f;font-size:.6em}.tippy-box[data-theme~=light-border] .tippy-arrow{color:#6f6f6f}.tippy-box[data-placement^=bottom]>.tippy-content{padding:7px 10px;z-index:1}.reveal .callout.callout-style-simple .callout-body,.reveal .callout.callout-style-default .callout-body,.reveal .callout.callout-style-simple div.callout-title,.reveal .callout.callout-style-default div.callout-title{font-size:inherit}.reveal .callout.callout-style-default .callout-icon::before,.reveal .callout.callout-style-simple .callout-icon::before{height:2rem;width:2rem;background-size:2rem 2rem}.reveal .callout.callout-titled .callout-title p{margin-top:.5em}.reveal .callout.callout-titled .callout-icon::before{margin-top:1rem}.reveal .callout.callout-titled .callout-body>.callout-content>:last-child{margin-bottom:1rem}.reveal .panel-tabset [role=tab]{padding:.25em .7em}.reveal .slide-menu-button .fa-bars::before{background-image:url('data:image/svg+xml,')}.reveal .slide-chalkboard-buttons .fa-easel2::before{background-image:url('data:image/svg+xml,')}.reveal .slide-chalkboard-buttons .fa-brush::before{background-image:url('data:image/svg+xml,')}/*! light */.reveal ol[type=a]{list-style-type:lower-alpha}.reveal ol[type=a s]{list-style-type:lower-alpha}.reveal ol[type=A s]{list-style-type:upper-alpha}.reveal ol[type=i]{list-style-type:lower-roman}.reveal ol[type=i s]{list-style-type:lower-roman}.reveal ol[type=I s]{list-style-type:upper-roman}.reveal ol[type="1"]{list-style-type:decimal}.reveal ul.task-list{list-style:none}.reveal ul.task-list li input[type=checkbox]{width:2em;height:2em;margin:0 1em .5em -1.6em;vertical-align:middle}div.cell-output-display div.pagedtable-wrapper table.table{font-size:.6em}.reveal .code-annotation-container-hidden{display:none}.reveal code.sourceCode button.code-annotation-anchor,.reveal code.sourceCode .code-annotation-anchor{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:var(--quarto-hl-co-color);border:solid var(--quarto-hl-co-color) 1px;border-radius:50%;font-size:.7em;line-height:1.2em;margin-top:2px;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none}.reveal code.sourceCode button.code-annotation-anchor{cursor:pointer}.reveal code.sourceCode a.code-annotation-anchor{text-align:center;vertical-align:middle;text-decoration:none;cursor:default;height:1.2em;width:1.2em}.reveal code.sourceCode.fragment a.code-annotation-anchor{left:auto}.reveal #code-annotation-line-highlight-gutter{width:100%;border-top:solid var(--quarto-hl-co-color) 1px;border-bottom:solid var(--quarto-hl-co-color) 1px;z-index:2}.reveal #code-annotation-line-highlight{margin-left:-8em;width:calc(100% + 4em);border-top:solid var(--quarto-hl-co-color) 1px;border-bottom:solid var(--quarto-hl-co-color) 1px;z-index:2;margin-bottom:-2px}.reveal code.sourceCode .code-annotation-anchor.code-annotation-active{background-color:var(--quarto-hl-normal-color, #aaaaaa);border:solid var(--quarto-hl-normal-color, #aaaaaa) 1px;color:#fff;font-weight:bolder}.reveal pre.code-annotation-code{padding-top:0;padding-bottom:0}.reveal pre.code-annotation-code code{z-index:3;padding-left:0px}.reveal dl.code-annotation-container-grid{margin-left:.1em}.reveal dl.code-annotation-container-grid dt{margin-top:.65rem;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;border:solid #222 1px;border-radius:50%;height:1.3em;width:1.3em;line-height:1.3em;font-size:.5em;text-align:center;vertical-align:middle;text-decoration:none}.reveal dl.code-annotation-container-grid dd{margin-left:.25em}.reveal .scrollable ol li:first-child:nth-last-child(n+10),.reveal .scrollable ol li:first-child:nth-last-child(n+10)~li{margin-left:1em}html.print-pdf .reveal .slides .pdf-page:last-child{page-break-after:avoid}.reveal .quarto-title-block .quarto-title-authors{display:flex;justify-content:center}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author{padding-left:.5em;padding-right:.5em}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:hover,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:visited,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:active{color:inherit;text-decoration:none}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-name{margin-bottom:.1rem}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-email{margin-top:0px;margin-bottom:.4em;font-size:.6em}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-orcid img{margin-bottom:4px}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-affiliation{font-size:.7em;margin-top:0px;margin-bottom:8px}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-affiliation:first{margin-top:12px}/*# sourceMappingURL=f95d2bded9c28492b788fe14c3e9f347.css.map */ +*/.ansi-black-fg{color:#3e424d}.ansi-black-bg{background-color:#3e424d}.ansi-black-intense-black,.ansi-bright-black-fg{color:#282c36}.ansi-black-intense-black,.ansi-bright-black-bg{background-color:#282c36}.ansi-red-fg{color:#e75c58}.ansi-red-bg{background-color:#e75c58}.ansi-red-intense-red,.ansi-bright-red-fg{color:#b22b31}.ansi-red-intense-red,.ansi-bright-red-bg{background-color:#b22b31}.ansi-green-fg{color:#00a250}.ansi-green-bg{background-color:#00a250}.ansi-green-intense-green,.ansi-bright-green-fg{color:#007427}.ansi-green-intense-green,.ansi-bright-green-bg{background-color:#007427}.ansi-yellow-fg{color:#ddb62b}.ansi-yellow-bg{background-color:#ddb62b}.ansi-yellow-intense-yellow,.ansi-bright-yellow-fg{color:#b27d12}.ansi-yellow-intense-yellow,.ansi-bright-yellow-bg{background-color:#b27d12}.ansi-blue-fg{color:#208ffb}.ansi-blue-bg{background-color:#208ffb}.ansi-blue-intense-blue,.ansi-bright-blue-fg{color:#0065ca}.ansi-blue-intense-blue,.ansi-bright-blue-bg{background-color:#0065ca}.ansi-magenta-fg{color:#d160c4}.ansi-magenta-bg{background-color:#d160c4}.ansi-magenta-intense-magenta,.ansi-bright-magenta-fg{color:#a03196}.ansi-magenta-intense-magenta,.ansi-bright-magenta-bg{background-color:#a03196}.ansi-cyan-fg{color:#60c6c8}.ansi-cyan-bg{background-color:#60c6c8}.ansi-cyan-intense-cyan,.ansi-bright-cyan-fg{color:#258f8f}.ansi-cyan-intense-cyan,.ansi-bright-cyan-bg{background-color:#258f8f}.ansi-white-fg{color:#c5c1b4}.ansi-white-bg{background-color:#c5c1b4}.ansi-white-intense-white,.ansi-bright-white-fg{color:#a1a6b2}.ansi-white-intense-white,.ansi-bright-white-bg{background-color:#a1a6b2}.ansi-default-inverse-fg{color:#fff}.ansi-default-inverse-bg{background-color:#000}.ansi-bold{font-weight:bold}.ansi-underline{text-decoration:underline}:root{--quarto-body-bg: #fff;--quarto-body-color: #222;--quarto-text-muted: #6f6f6f;--quarto-border-color: #bbbbbb;--quarto-border-width: 1px;--quarto-border-radius: 4px}table.gt_table{color:var(--quarto-body-color);font-size:1em;width:100%;background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_column_spanner_outer{color:var(--quarto-body-color);background-color:rgba(0,0,0,0);border-top-width:inherit;border-bottom-width:inherit;border-color:var(--quarto-border-color)}table.gt_table th.gt_col_heading{color:var(--quarto-body-color);font-weight:bold;background-color:rgba(0,0,0,0)}table.gt_table thead.gt_col_headings{border-bottom:1px solid currentColor;border-top-width:inherit;border-top-color:var(--quarto-border-color)}table.gt_table thead.gt_col_headings:not(:first-child){border-top-width:1px;border-top-color:var(--quarto-border-color)}table.gt_table td.gt_row{border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-width:0px}table.gt_table tbody.gt_table_body{border-top-width:1px;border-bottom-width:1px;border-bottom-color:var(--quarto-border-color);border-top-color:currentColor}div.columns{display:initial;gap:initial}div.column{display:inline-block;overflow-x:initial;vertical-align:top;width:50%}.code-annotation-tip-content{word-wrap:break-word}.code-annotation-container-hidden{display:none !important}dl.code-annotation-container-grid{display:grid;grid-template-columns:min-content auto}dl.code-annotation-container-grid dt{grid-column:1}dl.code-annotation-container-grid dd{grid-column:2}pre.sourceCode.code-annotation-code{padding-right:0}code.sourceCode .code-annotation-anchor{z-index:100;position:relative;float:right;background-color:rgba(0,0,0,0)}input[type=checkbox]{margin-right:.5ch}:root{--mermaid-bg-color: #fff;--mermaid-edge-color: #999;--mermaid-node-fg-color: #222;--mermaid-fg-color: #222;--mermaid-fg-color--lighter: #3c3c3c;--mermaid-fg-color--lightest: #555555;--mermaid-font-family: Source Sans Pro, Helvetica, sans-serif;--mermaid-label-bg-color: #fff;--mermaid-label-fg-color: #468;--mermaid-node-bg-color: rgba(68, 102, 136, 0.1);--mermaid-node-fg-color: #222}@media print{:root{font-size:11pt}#quarto-sidebar,#TOC,.nav-page{display:none}.page-columns .content{grid-column-start:page-start}.fixed-top{position:relative}.panel-caption,.figure-caption,figcaption{color:#666}}.code-copy-button{position:absolute;top:0;right:0;border:0;margin-top:5px;margin-right:5px;background-color:rgba(0,0,0,0);z-index:3}.code-copy-button:focus{outline:none}.code-copy-button-tooltip{font-size:.75em}pre.sourceCode:hover>.code-copy-button>.bi::before{display:inline-block;height:1rem;width:1rem;content:"";vertical-align:-0.125em;background-image:url('data:image/svg+xml,');background-repeat:no-repeat;background-size:1rem 1rem}pre.sourceCode:hover>.code-copy-button-checked>.bi::before{background-image:url('data:image/svg+xml,')}pre.sourceCode:hover>.code-copy-button:hover>.bi::before{background-image:url('data:image/svg+xml,')}pre.sourceCode:hover>.code-copy-button-checked:hover>.bi::before{background-image:url('data:image/svg+xml,')}.panel-tabset [role=tablist]{border-bottom:1px solid #bbb;list-style:none;margin:0;padding:0;width:100%}.panel-tabset [role=tablist] *{-webkit-box-sizing:border-box;box-sizing:border-box}@media(min-width: 30em){.panel-tabset [role=tablist] li{display:inline-block}}.panel-tabset [role=tab]{border:1px solid rgba(0,0,0,0);border-top-color:#bbb;display:block;padding:.5em 1em;text-decoration:none}@media(min-width: 30em){.panel-tabset [role=tab]{border-top-color:rgba(0,0,0,0);display:inline-block;margin-bottom:-1px}}.panel-tabset [role=tab][aria-selected=true]{background-color:#bbb}@media(min-width: 30em){.panel-tabset [role=tab][aria-selected=true]{background-color:rgba(0,0,0,0);border:1px solid #bbb;border-bottom-color:#fff}}@media(min-width: 30em){.panel-tabset [role=tab]:hover:not([aria-selected=true]){border:1px solid #bbb}}.code-with-filename .code-with-filename-file{margin-bottom:0;padding-bottom:2px;padding-top:2px;padding-left:.7em;border:var(--quarto-border-width) solid var(--quarto-border-color);border-radius:var(--quarto-border-radius);border-bottom:0;border-bottom-left-radius:0%;border-bottom-right-radius:0%}.code-with-filename div.sourceCode,.reveal .code-with-filename div.sourceCode{margin-top:0;border-top-left-radius:0%;border-top-right-radius:0%}.code-with-filename .code-with-filename-file pre{margin-bottom:0}.code-with-filename .code-with-filename-file{background-color:rgba(219,219,219,.8)}.quarto-dark .code-with-filename .code-with-filename-file{background-color:#555}.code-with-filename .code-with-filename-file strong{font-weight:400}.reveal.center .slide aside,.reveal.center .slide div.aside{position:initial}section.has-light-background,section.has-light-background h1,section.has-light-background h2,section.has-light-background h3,section.has-light-background h4,section.has-light-background h5,section.has-light-background h6{color:#222}section.has-light-background a,section.has-light-background a:hover{color:#2a76dd}section.has-light-background code{color:#4758ab}section.has-dark-background,section.has-dark-background h1,section.has-dark-background h2,section.has-dark-background h3,section.has-dark-background h4,section.has-dark-background h5,section.has-dark-background h6{color:#fff}section.has-dark-background a,section.has-dark-background a:hover{color:#42affa}section.has-dark-background code{color:#ffa07a}#title-slide,div.reveal div.slides section.quarto-title-block{text-align:center}#title-slide .subtitle,div.reveal div.slides section.quarto-title-block .subtitle{margin-bottom:2.5rem}.reveal .slides{text-align:left}.reveal .title-slide h1{font-size:1.6em}.reveal[data-navigation-mode=linear] .title-slide h1{font-size:2.5em}.reveal div.sourceCode{border:1px solid #bbb;border-radius:4px}.reveal pre{width:100%;box-shadow:none;background-color:#fff;border:none;margin:0;font-size:.55em}.reveal .code-with-filename .code-with-filename-file pre{background-color:unset}.reveal code{color:var(--quarto-hl-fu-color);background-color:rgba(0,0,0,0);white-space:pre-wrap}.reveal pre.sourceCode code{background-color:#fff;padding:6px 9px;max-height:500px;white-space:pre}.reveal pre code{background-color:#fff;color:#222}.reveal .column-output-location{display:flex;align-items:stretch}.reveal .column-output-location .column:first-of-type div.sourceCode{height:100%;background-color:#fff}.reveal blockquote{display:block;position:relative;color:#6f6f6f;width:unset;margin:var(--r-block-margin) auto;padding:.625rem 1.75rem;border-left:.25rem solid #6f6f6f;font-style:normal;background:none;box-shadow:none}.reveal blockquote p:first-child,.reveal blockquote p:last-child{display:block}.reveal .slide aside,.reveal .slide div.aside{position:absolute;bottom:20px;font-size:0.7em;color:#6f6f6f}.reveal .slide sup{font-size:0.7em}.reveal .slide.scrollable aside,.reveal .slide.scrollable div.aside{position:relative;margin-top:1em}.reveal .slide aside .aside-footnotes{margin-bottom:0}.reveal .slide aside .aside-footnotes li:first-of-type{margin-top:0}.reveal .layout-sidebar{display:flex;width:100%;margin-top:.8em}.reveal .layout-sidebar .panel-sidebar{width:270px}.reveal .layout-sidebar-left .panel-sidebar{margin-right:calc(0.5em*2)}.reveal .layout-sidebar-right .panel-sidebar{margin-left:calc(0.5em*2)}.reveal .layout-sidebar .panel-fill,.reveal .layout-sidebar .panel-center,.reveal .layout-sidebar .panel-tabset{flex:1}.reveal .panel-input,.reveal .panel-sidebar{font-size:.5em;padding:.5em;border-style:solid;border-color:#bbb;border-width:1px;border-radius:4px;background-color:#f8f9fa}.reveal .panel-sidebar :first-child,.reveal .panel-fill :first-child{margin-top:0}.reveal .panel-sidebar :last-child,.reveal .panel-fill :last-child{margin-bottom:0}.panel-input>div,.panel-input>div>div{vertical-align:middle;padding-right:1em}.reveal p,.reveal .slides section,.reveal .slides section>section{line-height:1.3}.reveal.smaller .slides section,.reveal .slides section.smaller,.reveal .slides section .callout{font-size:0.7em}.reveal.smaller .slides section section{font-size:inherit}.reveal.smaller .slides h1,.reveal .slides section.smaller h1{font-size:calc(2.5em/0.7)}.reveal.smaller .slides h2,.reveal .slides section.smaller h2{font-size:calc(1.6em/0.7)}.reveal.smaller .slides h3,.reveal .slides section.smaller h3{font-size:calc(1.3em/0.7)}.reveal .columns>.column>:not(ul,ol){margin-left:.25em;margin-right:.25em}.reveal .columns>.column:first-child>:not(ul,ol){margin-right:.5em;margin-left:0}.reveal .columns>.column:last-child>:not(ul,ol){margin-right:0;margin-left:.5em}.reveal .slide-number{color:#5692e4;background-color:#fff}.reveal .footer{color:#6f6f6f}.reveal .footer a{color:#2a76dd}.reveal .footer.has-dark-background{color:#fff}.reveal .footer.has-dark-background a{color:#7bc6fa}.reveal .footer.has-light-background{color:#505050}.reveal .footer.has-light-background a{color:#6a9bdd}.reveal .slide-number{color:#6f6f6f}.reveal .slide-number.has-dark-background{color:#fff}.reveal .slide-number.has-light-background{color:#505050}.reveal .slide figure>figcaption,.reveal .slide img.stretch+p.caption,.reveal .slide img.r-stretch+p.caption{font-size:0.7em}@media screen and (min-width: 500px){.reveal .controls[data-controls-layout=edges] .navigate-left{left:.2em}.reveal .controls[data-controls-layout=edges] .navigate-right{right:.2em}.reveal .controls[data-controls-layout=edges] .navigate-up{top:.4em}.reveal .controls[data-controls-layout=edges] .navigate-down{bottom:2.3em}}.tippy-box[data-theme~=light-border]{background-color:#fff;color:#222;border-radius:4px;border:solid 1px #6f6f6f;font-size:.6em}.tippy-box[data-theme~=light-border] .tippy-arrow{color:#6f6f6f}.tippy-box[data-placement^=bottom]>.tippy-content{padding:7px 10px;z-index:1}.reveal .callout.callout-style-simple .callout-body,.reveal .callout.callout-style-default .callout-body,.reveal .callout.callout-style-simple div.callout-title,.reveal .callout.callout-style-default div.callout-title{font-size:inherit}.reveal .callout.callout-style-default .callout-icon::before,.reveal .callout.callout-style-simple .callout-icon::before{height:2rem;width:2rem;background-size:2rem 2rem}.reveal .callout.callout-titled .callout-title p{margin-top:.5em}.reveal .callout.callout-titled .callout-icon::before{margin-top:1rem}.reveal .callout.callout-titled .callout-body>.callout-content>:last-child{margin-bottom:1rem}.reveal .panel-tabset [role=tab]{padding:.25em .7em}.reveal .slide-menu-button .fa-bars::before{background-image:url('data:image/svg+xml,')}.reveal .slide-chalkboard-buttons .fa-easel2::before{background-image:url('data:image/svg+xml,')}.reveal .slide-chalkboard-buttons .fa-brush::before{background-image:url('data:image/svg+xml,')}/*! light */.reveal ol[type=a]{list-style-type:lower-alpha}.reveal ol[type=a s]{list-style-type:lower-alpha}.reveal ol[type=A s]{list-style-type:upper-alpha}.reveal ol[type=i]{list-style-type:lower-roman}.reveal ol[type=i s]{list-style-type:lower-roman}.reveal ol[type=I s]{list-style-type:upper-roman}.reveal ol[type="1"]{list-style-type:decimal}.reveal ul.task-list{list-style:none}.reveal ul.task-list li input[type=checkbox]{width:2em;height:2em;margin:0 1em .5em -1.6em;vertical-align:middle}div.cell-output-display div.pagedtable-wrapper table.table{font-size:.6em}.reveal .code-annotation-container-hidden{display:none}.reveal code.sourceCode button.code-annotation-anchor,.reveal code.sourceCode .code-annotation-anchor{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;color:var(--quarto-hl-co-color);border:solid var(--quarto-hl-co-color) 1px;border-radius:50%;font-size:.7em;line-height:1.2em;margin-top:2px;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none}.reveal code.sourceCode button.code-annotation-anchor{cursor:pointer}.reveal code.sourceCode a.code-annotation-anchor{text-align:center;vertical-align:middle;text-decoration:none;cursor:default;height:1.2em;width:1.2em}.reveal code.sourceCode.fragment a.code-annotation-anchor{left:auto}.reveal #code-annotation-line-highlight-gutter{width:100%;border-top:solid var(--quarto-hl-co-color) 1px;border-bottom:solid var(--quarto-hl-co-color) 1px;z-index:2}.reveal #code-annotation-line-highlight{margin-left:-8em;width:calc(100% + 4em);border-top:solid var(--quarto-hl-co-color) 1px;border-bottom:solid var(--quarto-hl-co-color) 1px;z-index:2;margin-bottom:-2px}.reveal code.sourceCode .code-annotation-anchor.code-annotation-active{background-color:var(--quarto-hl-normal-color, #aaaaaa);border:solid var(--quarto-hl-normal-color, #aaaaaa) 1px;color:#fff;font-weight:bolder}.reveal pre.code-annotation-code{padding-top:0;padding-bottom:0}.reveal pre.code-annotation-code code{z-index:3;padding-left:0px}.reveal dl.code-annotation-container-grid{margin-left:.1em}.reveal dl.code-annotation-container-grid dt{margin-top:.65rem;font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;border:solid #222 1px;border-radius:50%;height:1.3em;width:1.3em;line-height:1.3em;font-size:.5em;text-align:center;vertical-align:middle;text-decoration:none}.reveal dl.code-annotation-container-grid dd{margin-left:.25em}.reveal .scrollable ol li:first-child:nth-last-child(n+10),.reveal .scrollable ol li:first-child:nth-last-child(n+10)~li{margin-left:1em}html.print-pdf .reveal .slides .pdf-page:last-child{page-break-after:avoid}.reveal .quarto-title-block .quarto-title-authors{display:flex;justify-content:center}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author{padding-left:.5em;padding-right:.5em}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:hover,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:visited,.reveal .quarto-title-block .quarto-title-authors .quarto-title-author a:active{color:inherit;text-decoration:none}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-name{margin-bottom:.1rem}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-email{margin-top:0px;margin-bottom:.4em;font-size:.6em}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-author-orcid img{margin-bottom:4px}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-affiliation{font-size:.7em;margin-top:0px;margin-bottom:8px}.reveal .quarto-title-block .quarto-title-authors .quarto-title-author .quarto-title-affiliation:first{margin-top:12px}/*# sourceMappingURL=f95d2bded9c28492b788fe14c3e9f347.css.map */ diff --git a/_targets/meta/meta b/_targets/meta/meta index ef2398d..b829288 100644 --- a/_targets/meta/meta +++ b/_targets/meta/meta @@ -1,5 +1,5 @@ name|type|data|command|depend|seed|path|time|size|bytes|format|repository|iteration|parent|children|seconds|warnings|error -.Random.seed|object|1d7bcbd0b58011f0||||||||||||||| +.Random.seed|object|a03200921334c2c6||||||||||||||| <<<<<<< HEAD||||||||||||||||| =======||||||||||||||||| >>>>>>> 41e165e23859277d39cf61b308708a7560fe205e||||||||||||||||| @@ -102,16 +102,16 @@ running|stem|61eead8ba963be3f|956b64ad94546a1a|2c530c1562a7fbd1|-862476045|runni running_R|stem|b7ad3a2d6cd23fb4|fafabdc392a1c457|ef46db3751d8e999|1823033080|running_R.Rmd|t19491.8569417426s|abae671ba45f936d|6269|file|local|vector|||0|| running_R_slides|stem|b2f471da9a1054c1|9e6a9740611d51c0|6c2c968cb09b7f32|-177892044|running_R_slides.pdf*running_R_slides.Rmd|t19380.023540738s|f68c06cce266f515|683789|file|local|vector|||9.82|| survival|stem|913d11b9bedcdbf3|56b23edcc67219d9|2c530c1562a7fbd1|677208215|survival.html*survival.pdf*survival.qmd|t19981.1364955421s|e031bcb14e6c18f3|4692065|file|local|vector|||69.944|| -tidy_extra|stem|03f92a2964d81ee8|340d430efa8cfacb|2c530c1562a7fbd1|-1229011653|tidy_extra.html*tidy_extra.pdf*tidy_extra.qmd|t20034.7656642459s|84aed80aab5eaa8a|4046975|file|local|vector|||8.908|| +tidy_extra|stem|bb338b4e0ccb5c52|340d430efa8cfacb|2c530c1562a7fbd1|-1229011653|tidy_extra.html*tidy_extra.pdf*tidy_extra.qmd|t20039.6499388493s|047d43ff3d553dc1|4050010|file|local|vector|||8.878|| tidy_extra_R|stem|40b3bb2cad848afe|27ae0db1566ab416|ef46db3751d8e999|494476271|tidy_extra_R.Rmd|t19489.6454055228s|8180f285072afcc2|4383|file|local|vector|||0|| tidy_extra_R_slides|stem|60356cce088e9e58|1873ac2e1bc89784|48b1a36c6a6b1301|681695817|tidy_extra_R_slides.pdf*tidy_extra_R_slides.Rmd|t19379.994590682s|a684e4b4621b7b7e|61834|file|local|vector|||11.032|| -tidying|stem|520c0b5ceda4b705|e3399ae573ccf4de|2c530c1562a7fbd1|-815462382|tidying.html*tidying.pdf*tidying.qmd|t20034.7242282032s|5537748544c54f28|6190832|file|local|vector|||20.085|| +tidying|stem|520c0b5ceda4b705|e3399ae573ccf4de|2c530c1562a7fbd1|-815462382|tidying.html*tidying.pdf*tidying.qmd|t20039.1947738296s|5537748544c54f28|6190832|file|local|vector|||20.085|| tidying_R|stem|7e812dfd7161baa5|45cc31f6e5e85a71|ef46db3751d8e999|1298264764|tidying_R.Rmd|t19430.6527178298s|82f22308315f063e|10839|file|local|vector|||0|| tidying_R_slides|stem|b08fa955622715cf|c902e5afc4569891|430369db8d858b0b|348967195|tidying_R_slides.pdf*tidying_R_slides.Rmd|t19380.2030581059s|856608e6a12a2eeb|1464366|file|local|vector|||2437.661|| vector_matrix|stem|2652568af1bc3c43|2508c865e81ead66|2c530c1562a7fbd1|-848478896|vector_matrix.html*vector_matrix.pdf*vector_matrix.qmd|t19981.1364964101s|8c58fbe885a6a4d5|3681938|file|local|vector|||12.722|| -wider_wrong|stem|ba1f3f9c6202ae7f|ef920a95f0d273a3|2c530c1562a7fbd1|-1326064152|wider_wrong_files*wider_wrong.html*wider_wrong.pdf*wider_wrong.qmd|t20034.7655602492s|ea5c4a8abe9b84b1|3697736|file|local|vector|||7.55|| +wider_wrong|stem|ba1f3f9c6202ae7f|ef920a95f0d273a3|2c530c1562a7fbd1|-1326064152|wider_wrong_files*wider_wrong.html*wider_wrong.pdf*wider_wrong.qmd|t20039.1947772898s|7d2b550262ee57af|3684274|file|local|vector|||7.55|| wider_wrong_slides|stem|608292203f981279|e4a5847aa25bd829|cdc50657a9350338|262913204|wider_wrong_slides.pdf*wider_wrong_slides.Rmd|t19380.2030608837s|dd7ce027b6fa5365|45021|file|local|vector|||85.929|package cmdstanr was built under R version 4.3.0| -windmill|stem|e04d1da06349aad2|7310a077a4901c9a|2c530c1562a7fbd1|-761679766|windmill.html*windmill.pdf*windmill.qmd|t19981.1364966532s|36ea5094a4f0f646|4518903|file|local|vector|||23.365|| +windmill|stem|1e153068a7e04f9f|7310a077a4901c9a|2c530c1562a7fbd1|-761679766|windmill.html*windmill.pdf*windmill.qmd|t20039.64983588s|a36b427641f7ae74|4518388|file|local|vector|||14.414|| windmill_slides|stem|4231604f24ed30b6|ca80591eeba57987|ddbba9933c9282f4|-365915698|windmill_slides.pdf*windmill_slides.Rmd|t19380.0237043962s|80de266df74f2b95|167475|file|local|vector|||14.146|| with_categ|stem|c894d365a5a65584|015a716e3c0ecdcc|2c530c1562a7fbd1|-1943781519|with_categ_files*with_categ.html*with_categ.pdf*with_categ.qmd|t19981.1364966995s|a31bce9bfd516735|3778260|file|local|vector|||13.89|| with_categ_R|stem|bdf3967c9bc92f14|3a4a4b51d78d174f|ef46db3751d8e999|-425767943|with_categ_R.Rmd|t19320.6773734849s|493ddf0ca9d8fe86|3759|file|local|vector|||0|| diff --git a/tidy_extra.html b/tidy_extra.html index b1e9ab9..82e1828 100644 --- a/tidy_extra.html +++ b/tidy_extra.html @@ -2822,11 +2822,19 @@

Attempt 1

Attempt 2

-
repmes %>% pivot_longer(contains("_"),
-                        names_to=c("time", ".value"),
-                        names_sep="_"
-                        ) -> repmes3
-repmes3
+
repmes
+
+
+ +
+
+
repmes %>% pivot_longer(contains("_"),
+                        names_to=c("time", ".value"),
+                        names_sep="_"
+                        ) -> repmes3
+repmes3