Performance of a uniform forecast
Usage
add_uniform_pred(
test,
max_score,
discrete = TRUE,
include_samples = FALSE,
n_samples = NULL
)
Arguments
- test
Testing dataframe. The only requirements is that it contains a column "Score".
- max_score
Maximum value that the score can take
- discrete
Whether to estimate a discrete or continuous historical forecast
- include_samples
Whether to return samples from the historical forecast in the output
- n_samples
If include_samples=TRUE, how many samples to return. When NULL, the samples
0:max_score
are returned.
Value
Dataframe test
appended by the columns "lpd", "RPS" (or CRPS if discrete=FALSE) and optionally "Samples"
Examples
max_score <- 100
test <- data.frame(Score = rbinom(1e2, max_score, 0.5))
add_uniform_pred(test, max_score)
#> Score lpd RPS
#> 1 37 -4.615121 0.10089109
#> 2 51 -4.615121 0.08425743
#> 3 52 -4.615121 0.08455446
#> 4 52 -4.615121 0.08455446
#> 5 42 -4.615121 0.09049505
#> 6 44 -4.615121 0.08772277
#> 7 44 -4.615121 0.08772277
#> 8 44 -4.615121 0.08772277
#> 9 57 -4.615121 0.08900990
#> 10 51 -4.615121 0.08425743
#> 11 51 -4.615121 0.08425743
#> 12 57 -4.615121 0.08900990
#> 13 49 -4.615121 0.08425743
#> 14 44 -4.615121 0.08772277
#> 15 46 -4.615121 0.08574257
#> 16 41 -4.615121 0.09217822
#> 17 54 -4.615121 0.08574257
#> 18 55 -4.615121 0.08663366
#> 19 48 -4.615121 0.08455446
#> 20 51 -4.615121 0.08425743
#> 21 58 -4.615121 0.09049505
#> 22 51 -4.615121 0.08425743
#> 23 52 -4.615121 0.08455446
#> 24 51 -4.615121 0.08425743
#> 25 51 -4.615121 0.08425743
#> 26 43 -4.615121 0.08900990
#> 27 50 -4.615121 0.08415842
#> 28 49 -4.615121 0.08425743
#> 29 48 -4.615121 0.08455446
#> 30 47 -4.615121 0.08504950
#> 31 56 -4.615121 0.08772277
#> 32 50 -4.615121 0.08415842
#> 33 46 -4.615121 0.08574257
#> 34 48 -4.615121 0.08455446
#> 35 47 -4.615121 0.08504950
#> 36 45 -4.615121 0.08663366
#> 37 51 -4.615121 0.08425743
#> 38 50 -4.615121 0.08415842
#> 39 38 -4.615121 0.09841584
#> 40 48 -4.615121 0.08455446
#> 41 52 -4.615121 0.08455446
#> 42 46 -4.615121 0.08574257
#> 43 49 -4.615121 0.08425743
#> 44 45 -4.615121 0.08663366
#> 45 48 -4.615121 0.08455446
#> 46 55 -4.615121 0.08663366
#> 47 51 -4.615121 0.08425743
#> 48 52 -4.615121 0.08455446
#> 49 56 -4.615121 0.08772277
#> 50 45 -4.615121 0.08663366
#> 51 49 -4.615121 0.08425743
#> 52 59 -4.615121 0.09217822
#> 53 52 -4.615121 0.08455446
#> 54 46 -4.615121 0.08574257
#> 55 43 -4.615121 0.08900990
#> 56 44 -4.615121 0.08772277
#> 57 51 -4.615121 0.08425743
#> 58 41 -4.615121 0.09217822
#> 59 56 -4.615121 0.08772277
#> 60 57 -4.615121 0.08900990
#> 61 59 -4.615121 0.09217822
#> 62 51 -4.615121 0.08425743
#> 63 50 -4.615121 0.08415842
#> 64 50 -4.615121 0.08415842
#> 65 54 -4.615121 0.08574257
#> 66 58 -4.615121 0.09049505
#> 67 40 -4.615121 0.09405941
#> 68 49 -4.615121 0.08425743
#> 69 48 -4.615121 0.08455446
#> 70 47 -4.615121 0.08504950
#> 71 42 -4.615121 0.09049505
#> 72 51 -4.615121 0.08425743
#> 73 49 -4.615121 0.08425743
#> 74 54 -4.615121 0.08574257
#> 75 51 -4.615121 0.08425743
#> 76 45 -4.615121 0.08663366
#> 77 55 -4.615121 0.08663366
#> 78 55 -4.615121 0.08663366
#> 79 57 -4.615121 0.08900990
#> 80 60 -4.615121 0.09405941
#> 81 51 -4.615121 0.08425743
#> 82 52 -4.615121 0.08455446
#> 83 55 -4.615121 0.08663366
#> 84 45 -4.615121 0.08663366
#> 85 56 -4.615121 0.08772277
#> 86 51 -4.615121 0.08425743
#> 87 47 -4.615121 0.08504950
#> 88 50 -4.615121 0.08415842
#> 89 51 -4.615121 0.08425743
#> 90 49 -4.615121 0.08425743
#> 91 54 -4.615121 0.08574257
#> 92 51 -4.615121 0.08425743
#> 93 47 -4.615121 0.08504950
#> 94 50 -4.615121 0.08415842
#> 95 54 -4.615121 0.08574257
#> 96 58 -4.615121 0.09049505
#> 97 41 -4.615121 0.09217822
#> 98 47 -4.615121 0.08504950
#> 99 55 -4.615121 0.08663366
#> 100 54 -4.615121 0.08574257