scoring: Proper scoring rules
> library(scoring)
> data("WeatherProbs")
> data("WorldEvents")
バージョン: 0.5.1
関数名 | 概略 |
---|---|
WeatherProbs |
Three-category weather forecasts |
WorldEvents |
Forecasts of world events |
brierscore |
Calculate Brier Scores And Decompositions |
calcscore |
Calculate Scores Under A Specific Rule |
logscore |
Calculate Logarithmic Scores |
plotscore |
Plot a Two-Alternative Scoring Rule |
sphscore |
Calculate Spherical Scores |
WeatherProbs
> data("WeatherProbs")
> WeatherProbs %>% dplyr::glimpse()
Observations: 8,976
Variables: 11
$ stn (int) 69002, 69007, 69008, 69012, 69013, 69014, 69016, 69017, ...
$ made (date) 2009-04-01, 2009-04-01, 2009-04-01, 2009-04-01, 2009-04...
$ valid (date) 2009-04-09, 2009-04-09, 2009-04-09, 2009-04-09, 2009-04...
$ tblw (dbl) 0.4341, 0.4243, 0.4443, 0.2936, 0.3200, 0.4242, 0.4249, ...
$ tnrm (dbl) 0.3333, 0.3333, 0.3333, 0.4146, 0.3866, 0.3333, 0.3333, ...
$ tabv (dbl) 0.2326, 0.2424, 0.2224, 0.2918, 0.2934, 0.2425, 0.2418, ...
$ tcat (fctr) 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2...
$ pblw (dbl) 0.3140, 0.3141, 0.3141, 0.3059, 0.3276, 0.3146, 0.3146, ...
$ pnrm (dbl) 0.3835, 0.3759, 0.3841, 0.3333, 0.3333, 0.3755, 0.3755, ...
$ pabv (dbl) 0.3025, 0.3100, 0.3018, 0.3608, 0.3391, 0.3099, 0.3099, ...
$ pcat (fctr) 2, 2, 2, 3, 3, 2, 2, 3, 2, 2, 1, 1, 2, 1, 1, 2, 2, 3, 2...
WorldEvents
> data("WorldEvents")
> WorldEvents %>% dplyr::glimpse()
Observations: 21
Variables: 4
$ forecaster (int) 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, ...
$ item (int) 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, ...
$ answer (int) 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, ...
$ forecast (dbl) 0.51, 0.81, 0.41, 0.04, 0.15, 0.80, 0.51, 0.70, 0.7...
brierscore
Arguments
- object
- data
- group
- decomp
- bounds
- reverse
> brier1 <- brierscore(answer ~ forecast, data = WorldEvents)
> brier2 <- brierscore(answer ~ forecast, data = WorldEvents, group = "forecaster", decomp = TRUE)
> brier3 <- calcscore(answer ~ forecast, data = WorldEvents, param = 2, fam = "pow")
> all.equal(brier1, brier3)
[1] TRUE
calcscore
> scores <- calcscore(answer ~ forecast,
+ fam = "beta",
+ param = c(1,1),
+ data = WorldEvents,
+ bounds = c(0, 1))
> scores
[1] 0.2601 0.6561 0.3481 0.0016 0.0225 0.0400 0.2601 0.4900 0.0625 0.0000
[11] 1.0000 0.0000 0.0400 0.6400 0.0400 0.0000 0.6400 0.0049 0.0361 0.2601
[21] 0.5625
sphscore
> sph1 <- sphscore(answer ~ forecast, data = WorldEvents)
> sph1
[1] 0.3071739058 0.7716306565 0.4293433841 0.0008669269 0.0152164412
[6] 0.0298574999 0.3071739058 0.6060807014 0.0513167019 0.0000000000
[11] 1.0000000000 0.0000000000 0.0298574999 0.7574643750 0.0298574999
[16] 0.0000000000 0.7574643750 0.0028207177 0.0264254302 0.3071739058
[21] 0.6837722340