Package 'assessr'

Title: Performance metrics for probabilitic forecasts
Description: This package implements various metrics for assessing the performance of probabilitic forecasts.
Authors: Sangeeta Bhatia [aut, cre]
Maintainer: Sangeeta Bhatia <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2024-11-27 05:24:58 UTC
Source: https://github.com/mrc-ide/assessr

Help Index


MADM

Description

Median absolute deviation about the median

Usage

abs_madm(pred)

Arguments

pred

T X N Matrix of predictions. Each column is a simulation.

Details

median(predmedian(pred))median(|pred - median(pred)|)

Median absolute deviation about the median is a measure of how clustered the forecasts are. A value of 0 indicates that all the predicted values are the same, thus highly clustered. Large values indicate more diffuse predictions.

Value

vector of length T.

References

https://bit.ly/2vPO0I9

See Also

rel_madm()


Average Residual

Description

Residual averaged acorss simulations

Usage

avg_residual(obs, pred)

Arguments

obs

observed vector T X 1

pred

matrix of predicted observations. Each column is a simulation. T X N where N is the number of simulations.

Details

i=1Nobspred/N\sum_{i = 1}^{N}{obs - pred} / N

Value

error T X 1. Each entry is the error averaged across the simulations.

Author(s)

Sangeeta Bhatia


Bias

Description

Bias in probabilistic forecasts

Usage

bias(obs, pred)

Arguments

obs

observed vector T X 1

pred

Simulated predictions T X N. Each column is a simulation.

Details

Bias is measured as

2mean((heaviside(obspred))0.5)2 * mean((heaviside(obs - pred)) - 0.5)

where heaviside returns 1 if the arg is positive, 0 if this negative and 0.5 if it is 0. The average is taken over all simulations.

Value

vector of length T.

Author(s)

Sangeeta Bhatia

References

https://doi.org/10.1371/journal.pcbi.1006785


Mean absolute error

Description

Mean absolute error

Usage

mae(obs, pred)

Arguments

obs

T X 1 vector of observations.

pred

T X N matrix of predictions where each column is a simulation.

Value

T X 1 vector of mean absolute error

Author(s)

Sangeeta Bhatia


Proportion of observations in given credible interval

Description

Proportion of observations in given credible interval

Usage

prop_in_ci(obs, min, max)

Arguments

obs

vector of observed values

min

vector of the lower end of the interval. Either length 1 vector or the same length as the that of obs.

max

vector of the upper end of the interval. Either length 1 or the same length as that of the obs vector.

Details

Proportion of observed values that fall within a given interval

Value

proportion of values in obs vector that are greater than or equal to min and less than or equal to max.

Author(s)

Sangeeta Bhatia


Relative sharpness

Description

Relative sharpness: median absolute deviation about the median

Usage

rel_madm(pred)

Arguments

pred

T X N Matrix of predictions. Each column is a simulation.

Details

median((predmedian(pred))/pred)median(|(pred - median(pred))/pred|)

Value

vector of length T.

References

https://bit.ly/2vPO0I9

See Also

abs_madm()


Relative mean absolute error

Description

Relative mean absolute error

Usage

rel_mae(obs, pred)

Arguments

obs

T X 1 vector of observations.

pred

T X N matrix of predictions where each column is a simulation.

Details

Relative mean absolute error is defined as

i=1Nobspred/Nobs+1\sum_{i = 1}^{N}{|obs - pred|} / N * |obs + 1|

Value

T X 1 vector of mean absolute error normalised by the observed value.

Author(s)

Sangeeta Bhatia


Relative sharpness

Description

Relative mean absolute deviation about the median

Usage

rel_mean_dvtn(pred)

Arguments

pred

T X N Matrix of predictions. Each column is a simulation.

Details

median((predmedian(pred))/pred)median(|(pred - median(pred))/pred|)

Value

vector of length T.

References

https://bit.ly/2vPO0I9


Average relative mean squared error

Description

Relative mean squared error averaged acorss simulations

Usage

rel_mse(obs, pred)

Arguments

obs

observed vector T X 1

pred

matrix of predicted observations. Each column is a simulation. T X N where N is the number of simulations.

Details

Relative average mean square error is

i=1N(obspred)2/N(obs+1)2\sum_{i = 1}^{N}{(obs - pred)^2} / N * (obs + 1)^2

We add 1 to the observed vector to avoid dividing by 0.

Value

error T X 1. Each entry is the error averaged across the simulations

Author(s)

Sangeeta Bhatia