-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
executable file
·75 lines (56 loc) · 2.14 KB
/
README.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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# score4cast
<!-- badges: start -->
[![R-CMD-check](https://github.com/eco4cast/score4cast/workflows/R-CMD-check/badge.svg)](https://github.com/eco4cast/score4cast/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/score4cast)](https://CRAN.R-project.org/package=score4cast)
<!-- badges: end -->
The goal of score4cast is to provide a convenient interface to score ecological forecasts that conform the EFI standard.
score4cast emphasizes the use of strictly proper scores (see [scoringRules]() R package or Gneiting & Raferty's landmark 2007 paper) for _probablistic_ forecasts.
The EFI format provides a simple but flexible way to express both ensemble and parametric forecasts in a standard tabular layout.
## Installation
You can install the development version of score4cast from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("eco4cast/score4cast")
```
## Example
A forecast (in standardized format) is scored against a target (in standardized format):
```{r example}
library(score4cast)
ex_data <- system.file("extdata/standard-format-examples.R", package="score4cast")
source(ex_data)
scores <- score(ex_forecast, ex_target)
scores
```
```{r echo = FALSE, message=FALSE}
library(tidyverse)
```
## Example using Bernoulli distribution and extra columns for grouping
```{r}
forecast <- tibble(datetime = as_date("2023-01-02"),
site_id = "fcre",
depth = c(1,2),
model_id = "test",
reference_datetime = as_date("2023-01-02"),
variable = "temp",
family = "bernoulli",
parameter = "prob",
prediction = c(0.3, 0.1))
target <- tibble(datetime = as_date("2023-01-02"),
site_id = "fcre",
depth = c(1,2),
variable = "temp",
observation = c(1,0))
crps_logs_score(forecast,target, extra_groups = "depth")
```