Skip to contents

Wrapper around the logs_sample() function from the scoringRules package. Used to score continuous predictions. While the Log Score is in theory also applicable to integer forecasts, the problem lies in the implementation: The Log Score needs a kernel density estimation, which is not well defined with integer-valued Monte Carlo Samples. The Log Score can be used for specific integer valued probability distributions. See the scoringRules package for more details.

Usage

logs_sample(true_values, predictions)

Arguments

true_values

A vector with the true observed values of size n

predictions

nxN matrix of predictive samples, n (number of rows) being the number of data points and N (number of columns) the number of Monte Carlo samples. Alternatively, predictions can just be a vector of size n.

Value

vector with the scoring values

References

Alexander Jordan, Fabian Krüger, Sebastian Lerch, Evaluating Probabilistic Forecasts with scoringRules, https://www.jstatsoft.org/article/view/v090i12

Examples

true_values <- rpois(30, lambda = 1:30)
predictions <- replicate(200, rpois(n = 30, lambda = 1:30))
logs_sample(true_values, predictions)
#>  [1] 0.7494908 1.0919477 3.3271950 1.9234195 2.4318399 2.4545439 2.1356909
#>  [8] 1.9239871 2.9062721 2.2720969 3.8116822 2.2907329 2.3367677 2.2344713
#> [15] 3.2636670 2.3164318 2.4699314 2.4214885 2.9668527 2.5352744 5.3762493
#> [22] 3.7832992 2.4065689 2.6047600 2.5900973 3.9673890 6.2267761 3.1688208
#> [29] 2.8515763 2.7514476