Skip to content

Commit 76ec2f4

Browse files
committed
use function auto-links
1 parent 5cf2339 commit 76ec2f4

File tree

15 files changed

+100
-92
lines changed

15 files changed

+100
-92
lines changed

_freeze/epipredict/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/flatline-forecaster/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/forecast-framework/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/preprocessing-and-models/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/sliding-forecasters/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/tidymodels-intro/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/tidymodels-regression/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_quarto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ format:
5454
sidebar-width: 400px
5555
body-width: 600px
5656
theme: [cosmo, delphi-epitools.scss]
57-
57+
code-link: true

epipredict.qmd

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,39 @@ There are four types of components:
3939
3. Predictor: make predictions, using a fitted model object and processed test data
4040
4. Postprocessor: manipulate or transform the predictions before returning
4141

42-
Users familiar with [`{tidymodels}`](https://www.tidymodels.org) and especially
43-
the [`{workflows}`](https://workflows.tidymodels.org) package will notice a lot
42+
Users familiar with `{tidymodels}` and especially
43+
the `{workflows}` package will notice a lot
4444
of overlap. This is by design, and is in fact a feature. The truth is that
4545
`{epipredict}` is a wrapper around much that is contained in these packages.
4646
Therefore, if you want something from this -verse, it should "just work" (we hope).
4747

48-
The reason for the overlap is that `{workflows}` _already implements_ the first
48+
The reason for the overlap is that `workflows` _already implements_ the first
4949
three steps. And it does this very well. However, it is missing the
5050
postprocessing stage and currently has no plans for such an implementation.
5151
And this feature is important. All forecasters need post-processing. Anything more complicated (which is nearly everything)
5252
needs this as well.
5353

54-
The second omission from `{tidymodels}` is support for panel data. Besides
54+
The second omission from `tidymodels` is support for panel data. Besides
5555
epidemiological data, economics, psychology, sociology, and many other areas
56-
frequently deal with data of this type. So the framework of behind `{epipredict}`
56+
frequently deal with data of this type. So the framework of behind `epipredict`
5757
implements this. In principle, this has nothing to do with epidemiology, and
5858
one could simply use this package as a solution for the missing functionality in
59-
`{tidymodels}`. Again, this should "just work" (we hope).
59+
`tidymodels`. Again, this should "just work" (we hope).
6060

6161
All of the _panel data_ functionality is implemented through the `epi_df` data type
6262
described in the previous part. If you have different panel data, just force it
6363
into an `epi_df` as described in @sec-additional-keys.
6464

6565
## Why doesn't this package already exist?
6666

67-
- Parts of it actually DO exist. There's a universe called `{tidymodels}`. It
67+
- Parts of it actually DO exist. There's a universe called `tidymodels`. It
6868
handles pre-processing, training, and prediction, bound together, through a
69-
package called workflows. We built `{epipredict}` on top of that setup. In this
69+
package called workflows. We built `epipredict` on top of that setup. In this
7070
way, you CAN use almost everything they provide.
7171
- However, workflows doesn't do post-processing to the extent envisioned here.
72-
And nothing in `{tidymodels}` handles panel data.
72+
And nothing in `tidymodels` handles panel data.
7373
- The tidy-team doesn't have plans to do either of these things. (We checked).
74-
- There are two packages that do time series built on `{tidymodels}`, but it's
74+
- There are two packages that do time series built on `tidymodels`, but it's
7575
"basic" time series: 1-step AR models, exponential smoothing, STL decomposition,
7676
etc.[^1]
7777

@@ -94,6 +94,7 @@ in the built-in data frame).
9494
jhu <- case_death_rate_subset %>%
9595
filter(time_value >= max(time_value) - 30)
9696
97+
library(epipredict)
9798
out <- arx_forecaster(
9899
jhu,
99100
outcome = "death_rate",
@@ -128,7 +129,7 @@ By default, the forecaster predicts the outcome (`death_rate`) 1-week ahead,
128129
using 3 lags of each predictor (`case_rate` and `death_rate`) at 0 (today),
129130
1 week back and 2 weeks back. The predictors and outcome can be changed
130131
directly. The rest of the defaults are encapsulated into a list of arguments.
131-
This list is produced by `arx_args_list()`.
132+
This list is produced by `arx_args_list()`.
132133

133134
## Simple adjustments
134135

@@ -197,7 +198,7 @@ arx_args_list(
197198

198199
So far, our forecasts have been produced using simple linear regression. But this is not the only way to estimate such a model.
199200
The `trainer` argument determines the type of model we want.
200-
This takes a [`{parsnip}`](https://parsnip.tidymodels.org) model. The default is linear regression, but we could instead use a random forest with the `{ranger}` package:
201+
This takes a `{parsnip}` model. The default is linear regression, but we could instead use a random forest with the `{ranger}` package:
201202

202203
```{r ranger, warning = FALSE}
203204
out_rf <- arx_forecaster(jhu, "death_rate", c("case_rate", "death_rate"),

flatline-forecaster.qmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ source("_common.R")
1313

1414

1515
We will continue to use the `case_death_rate_subset` dataset that comes with the
16-
`epipredict` package. In brief, this is a subset of the JHU daily COVID-19 cases
16+
`{epipredict}` package. In brief, this is a subset of the JHU daily COVID-19 cases
1717
and deaths by state. While this dataset ranges from Dec 31, 2020 to Dec 31,
1818
2021, we will only consider a small subset at the end of that range to keep our
1919
example relatively simple.
2020

2121
```{r}
2222
jhu <- case_death_rate_subset %>%
23-
dplyr::filter(time_value >= as.Date("2021-09-01"))
23+
filter(time_value >= as.Date("2021-09-01"))
2424
2525
jhu
2626
```
@@ -32,6 +32,7 @@ eath rate one week into the future, is to input the `epi_df` and the name of
3232
the column from it that we want to predict in the `flatline_forecaster` function.
3333

3434
```{r}
35+
library(epipredict)
3536
one_week_ahead <- flatline_forecaster(jhu, outcome = "death_rate")
3637
one_week_ahead
3738
```

0 commit comments

Comments
 (0)