-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmetric-details.Rmd
79 lines (68 loc) · 2.28 KB
/
metric-details.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: "Details on the metrics implemented in `scoringutils`"
author: "Nikos Bosse"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Details on the metrics implemented in `scoringutils`}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(scoringutils)
library(kableExtra)
library(magrittr)
library(knitr)
library(data.table)
```
## Applicability of different metrics for different types of forecasts and formats
This table gives an overview for when which metric can be applied and gives a very brief description. Note that this table on shows the metrics as implemented in `scoringutils`. For example, only scoring of sample-based discrete and continuous distributions is implemented in `scoringutils`, but closed-form solutions often exist (e.g. in the `scoringRules` package).
```{r, echo = FALSE, results = "asis"}
data <- copy(metrics)
setnames(data, old = c("Discrete", "Continuous", "Binary", "Quantile"),
new = c("D", "C", "B", "Q"))
data[, c("Name", "Functions") := NULL]
replace <- function(x) {
x <- gsub("+", "y", x, fixed = TRUE)
x <- gsub("-", "n", x, fixed = TRUE)
return(x)
}
data$D <- replace(data$D)
data$C <- replace(data$C)
data$B <- replace(data$B)
data$Q <- replace(data$Q)
data[, 1:6] %>%
kbl(format = "html",
escape = FALSE,
align = "lccccl",
linesep = "\\addlinespace") %>%
column_spec(1, width = "3.2cm") %>%
column_spec(2, width = "1.5cm") %>%
column_spec(3, width = "1.5cm") %>%
column_spec(4, width = "1.3cm") %>%
column_spec(5, width = "1.5cm") %>%
column_spec(6, width = "6.0cm") %>%
add_header_above(c(" " = 1, "Sample-based" = 2, " " = 3)) %>%
row_spec(seq(1, nrow(data), 2), background = "Gainsboro") %>%
kable_styling()
```
## Detailed explanation of the metrics implemented in `scoringutils`
```{r, echo = FALSE, results = "asis"}
data <- readRDS(
system.file(
"metrics-overview", "metrics-detailed.rds",
package = "scoringutils"
)
)
data[, 1:2] %>%
kbl(format = "html",
escape = TRUE) %>%
column_spec(1, width = "3.5cm") %>%
row_spec(seq(1, nrow(data), 2), background = "Gainsboro") %>%
column_spec(2, width = "15.5cm") %>%
kable_styling()
```