Skip to content

Commit bfcafba

Browse files
committed
filing
1 parent 48e469e commit bfcafba

16 files changed

+131
-39
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Aim: describe interval score in terms of model structure and country target type
22
# Load data:
3-
# source(here("R", "prep-data.R"))
3+
# source(here("R", "process-data.R"))
44
# scores <- prep_data(scoring_scale = "log")
55
library(here)
66
library(dplyr)

R/model-wis.R renamed to R/analysis-model.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ library(purrr)
77
library(mgcv)
88
library(gammit)
99
library(gratia)
10-
source(here("R", "prep-data.R"))
11-
source(here("R", "descriptive.R"))
10+
source(here("R", "process-data.R"))
11+
source(here("R", "analysis-descriptive.R"))
1212

1313
# --- Get data ---
1414
data <- prep_data(scoring_scale = "log")
File renamed without changes.

R/model-plots.R renamed to R/plot-model-results.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ library("dplyr")
33
library("ggplot2")
44
library("patchwork")
55
library("gammit")
6-
source(here("R", "prep-data.R"))
7-
source(here("R", "descriptive.R"))
6+
source(here("R", "process-data.R"))
7+
source(here("R", "analysis-descriptive.R"))
88

99
plot_models <- function(random_effects, scores, x_labels = TRUE,
1010
anonymise = TRUE) {

R/prep-data.R renamed to R/process-data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ classify_models <- function(file = here("data", "model-classification.csv")) {
3636
# Get scores for all forecasts and add explanatory variables used:
3737
# number of country targets, method classification, trend of observed incidence
3838
prep_data <- function(scoring_scale = "log") {
39-
scores_files <- list.files(here("output"), pattern = "scores-raw-.*\\.csv")
39+
scores_files <- list.files(here("data"), pattern = "scores-raw-.*\\.csv")
4040
names(scores_files) <- sub("scores-raw-(.*)\\..*$", "\\1", scores_files)
4141
# Get raw interval score
4242
scores_raw <- scores_files |>
4343
map(\(file) {
44-
read_csv(here("output", file))
44+
read_csv(here("data", file))
4545
}) |>
4646
bind_rows(.id = "outcome_target") |>
4747
filter(scale == scoring_scale)

R/score.R renamed to R/process-score.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ library(here)
22
library(dplyr)
33
library(purrr)
44
library(scoringutils)
5-
source(here("R", "import-data.R"))
5+
source(here("R", "utils-data.R"))
6+
source(here("R", "process-data.R"))
67

78
walk(c("case", "death"), \(target) {
89
# Get forecasts & observations -----
File renamed without changes.
File renamed without changes.

README.Rmd

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,23 @@ renv::restore()
6363
#### Data
6464

6565
All the data used in the analysis is stored in the `data/` directory. It
66-
has been obtained from public sources. In order to re-download the data
67-
in the `data/` directory, use
68-
69-
``` {r}
70-
## Get metadata from googlesheet; save to data/
71-
source(here("R", "get-metadata.R"))
72-
73-
## Get observed data and all Hub forecasts; exclude forecasts; save to data/
74-
source(here("R", "import-data.R"))
75-
```
66+
has been obtained from public sources. To re-download the data
67+
in the `data/` directory, see the [data/README](data/README.md).
7668

7769
#### Analyses
7870

7971
In order to re-generate the forecast scores, use
8072

8173
``` {r}
8274
## Score forecasts & ensembles on the log and natural scales; save to data/
83-
source(here("R", "score.R"))
75+
source(here("R", "process-score.R"))
8476
```
8577

8678
In order to run the GAM on the scores, use
8779

8880
``` {r}
8981
## Model the weighted interval score; save to data/
90-
source(here("R", "model-wis.R"))
82+
source(here("R", "analysis-model.R"))
9183
```
9284

9385
#### Results

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,23 @@ renv::restore()
7777
#### Data
7878

7979
All the data used in the analysis is stored in the `data/` directory. It
80-
has been obtained from public sources. In order to re-download the data
81-
in the `data/` directory, use
82-
83-
``` r
84-
## Get metadata from googlesheet; save to data/
85-
source(here("R", "get-metadata.R"))
86-
87-
## Get observed data and all Hub forecasts; exclude forecasts; save to data/
88-
source(here("R", "import-data.R"))
89-
```
80+
has been obtained from public sources. To re-download the data in the
81+
`data/` directory, see the [data/README](data/README.md).
9082

9183
#### Analyses
9284

9385
In order to re-generate the forecast scores, use
9486

9587
``` r
9688
## Score forecasts & ensembles on the log and natural scales; save to data/
97-
source(here("R", "score.R"))
89+
source(here("R", "process-score.R"))
9890
```
9991

10092
In order to run the GAM on the scores, use
10193

10294
``` r
10395
## Model the weighted interval score; save to data/
104-
source(here("R", "model-wis.R"))
96+
source(here("R", "analysis-model.R"))
10597
```
10698

10799
#### Results

0 commit comments

Comments
 (0)