diff --git a/.gitignore b/.gitignore index 5c2fdb14..b321ad92 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ docs README.html /doc/ /Meta/ +scoringutils.Rcheck/* diff --git a/R/documentation-templates.R b/R/documentation-templates.R index 77fb9d9f..66f0c287 100644 --- a/R/documentation-templates.R +++ b/R/documentation-templates.R @@ -94,7 +94,8 @@ NULL #' \if{html}{ #' \out{
} #' \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} -#' \out{
} +#' \out{

} +#' Overview of required input format for sample-based forecasts #' } #' \if{latex}{ #' \figure{metrics-sample.png} @@ -108,7 +109,8 @@ NULL #' \if{html}{ #' \out{

} #' \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"} -#' \out{
} +#' \out{

} +#' Overview of required input format for binary and point forecasts #' } #' \if{latex}{ #' \figure{metrics-binary-point.png} @@ -122,7 +124,8 @@ NULL #' \if{html}{ #' \out{

} #' \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} -#' \out{
} +#' \out{

} +#' Overview of required input format for quantile-based forecasts #' } #' \if{latex}{ #' \figure{metrics-quantile.png} @@ -136,7 +139,8 @@ NULL #' \if{html}{ #' \out{

} #' \figure{metrics-nominal.png}{options: style="width:750px;max-width:100\%;"} -#' \out{
} +#' \out{

} +#' Overview of required input format for nominal forecasts #' } #' \if{latex}{ #' \figure{metrics-nominal.png} diff --git a/R/metrics-quantile.R b/R/metrics-quantile.R index 2674464f..c7fcda0c 100644 --- a/R/metrics-quantile.R +++ b/R/metrics-quantile.R @@ -560,7 +560,7 @@ interpolate_median <- function(predicted, quantile_level) { #' #' Compute the absolute error of the median calculated as #' \deqn{ -#' |observed - median prediction| +#' |\text{observed} - \text{median prediction}| #' } #' The median prediction is the predicted value for which quantile_level == 0.5. #' The function requires 0.5 to be among the quantile levels in `quantile_level`. diff --git a/R/metrics-sample.R b/R/metrics-sample.R index 10f34f1d..7efb0f3b 100644 --- a/R/metrics-sample.R +++ b/R/metrics-sample.R @@ -120,7 +120,7 @@ bias_sample <- function(observed, predicted) { #' @description #' Absolute error of the median calculated as #' \deqn{ -#' |observed - median\_prediction| +#' |\text{observed} - \text{median prediction}| #' } #' where the median prediction is calculated as the median of the predictive #' samples. @@ -465,14 +465,14 @@ mad_sample <- function(observed = NULL, predicted, ...) { #' predictions, #' #' \deqn{ -# \bar{F}(u) = \frac{i = 1}{n} \sum_{i=1}^{n} F^{(i)}(u) +#' \bar{F}(u) = \frac{i = 1}{n} \sum_{i=1}^{n} F^{(i)}(u) #' } #' #' And calculating the value at each bin between quantile \eqn{q_i} and quantile #' \eqn{q_{i + 1}} as #' #' \deqn{ -# \bar{F}(q_i) - \bar{F}(q_{i + 1}) +#' \bar{F}(q_i) - \bar{F}(q_{i + 1}) #' } #' #' Alternatively, a randomised PIT can be used instead. In this case, the PIT is @@ -481,7 +481,7 @@ mad_sample <- function(observed = NULL, predicted, ...) { #' } #' #' where \eqn{v} is standard uniform and independent of \eqn{k}. The values of -#' the PIT histogram are then calculated by binning the $u_t$ values as above. +#' the PIT histogram are then calculated by binning the \eqn{u_t} values as above. #' #' @param quantiles A vector of quantiles between which to calculate the PIT. #' @param integers How to handle integer forecasts (count data). This is based diff --git a/R/pairwise-comparisons.R b/R/pairwise-comparisons.R index f9a26cab..24e7f692 100644 --- a/R/pairwise-comparisons.R +++ b/R/pairwise-comparisons.R @@ -14,12 +14,12 @@ #' The output of the pairwise comparisons is a set of mean score ratios, #' relative skill scores and p-values. #' -#' The following illustrates the pairwise comparison process: -#' #' \if{html}{ #' \out{

} #' \figure{pairwise-illustration.png}{options: style="width:750px;max-width:100\%;"} -#' \out{
} +#' \out{

} +#' Illustration of the pairwise comparison process. +#' #' } #' \if{latex}{ #' \figure{pairwise-illustration.png} diff --git a/man/ae_median_quantile.Rd b/man/ae_median_quantile.Rd index 20c40a9e..a67507fa 100644 --- a/man/ae_median_quantile.Rd +++ b/man/ae_median_quantile.Rd @@ -25,7 +25,7 @@ Numeric vector of length N with the absolute error of the median. \description{ Compute the absolute error of the median calculated as \deqn{ - |observed - median prediction| + |\text{observed} - \text{median prediction}| } The median prediction is the predicted value for which quantile_level == 0.5. The function requires 0.5 to be among the quantile levels in \code{quantile_level}. @@ -34,7 +34,8 @@ The function requires 0.5 to be among the quantile levels in \code{quantile_leve \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/ae_median_sample.Rd b/man/ae_median_sample.Rd index 2e2d4b29..985f0328 100644 --- a/man/ae_median_sample.Rd +++ b/man/ae_median_sample.Rd @@ -19,7 +19,7 @@ Numeric vector of length n with the absolute errors of the median. \description{ Absolute error of the median calculated as \deqn{ - |observed - median\_prediction| + |\text{observed} - \text{median prediction}| } where the median prediction is calculated as the median of the predictive samples. @@ -28,7 +28,8 @@ samples. \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/bias_quantile.Rd b/man/bias_quantile.Rd index 428ba3af..35f2021e 100644 --- a/man/bias_quantile.Rd +++ b/man/bias_quantile.Rd @@ -78,7 +78,8 @@ continuous forecasts (see \code{\link[=bias_sample]{bias_sample()}}). \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/bias_sample.Rd b/man/bias_sample.Rd index daedf180..48e259c2 100644 --- a/man/bias_sample.Rd +++ b/man/bias_sample.Rd @@ -49,7 +49,8 @@ In both cases, Bias can assume values between \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/crps_sample.Rd b/man/crps_sample.Rd index 01b1996f..ec5448d7 100644 --- a/man/crps_sample.Rd +++ b/man/crps_sample.Rd @@ -66,7 +66,8 @@ those of the \code{\link[=wis]{wis()}}. \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/dss_sample.Rd b/man/dss_sample.Rd index 906020b8..5b3bfd13 100644 --- a/man/dss_sample.Rd +++ b/man/dss_sample.Rd @@ -28,7 +28,8 @@ function from the \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/get_metrics.forecast_binary.Rd b/man/get_metrics.forecast_binary.Rd index a9e2ab3a..09bf9acd 100644 --- a/man/get_metrics.forecast_binary.Rd +++ b/man/get_metrics.forecast_binary.Rd @@ -32,7 +32,8 @@ For binary forecasts, the default scoring rules are: \if{html}{ \out{

} \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for binary and point forecasts } \if{latex}{ \figure{metrics-binary-point.png} diff --git a/man/get_metrics.forecast_point.Rd b/man/get_metrics.forecast_point.Rd index 38255ab1..20885785 100644 --- a/man/get_metrics.forecast_point.Rd +++ b/man/get_metrics.forecast_point.Rd @@ -43,7 +43,8 @@ results! Consider the example in the section below. \if{html}{ \out{

} \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for binary and point forecasts } \if{latex}{ \figure{metrics-binary-point.png} diff --git a/man/get_metrics.forecast_quantile.Rd b/man/get_metrics.forecast_quantile.Rd index 58396865..75c8974d 100644 --- a/man/get_metrics.forecast_quantile.Rd +++ b/man/get_metrics.forecast_quantile.Rd @@ -45,7 +45,8 @@ mean it would also get passed to \code{interval_coverage_50}. \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/get_metrics.forecast_sample.Rd b/man/get_metrics.forecast_sample.Rd index 2a94caa9..bd17bb18 100644 --- a/man/get_metrics.forecast_sample.Rd +++ b/man/get_metrics.forecast_sample.Rd @@ -37,7 +37,8 @@ For sample-based forecasts, the default scoring rules are: \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/get_pairwise_comparisons.Rd b/man/get_pairwise_comparisons.Rd index 3bc06c55..7b1abbda 100644 --- a/man/get_pairwise_comparisons.Rd +++ b/man/get_pairwise_comparisons.Rd @@ -61,12 +61,12 @@ overlapping forecasts between two models. The output of the pairwise comparisons is a set of mean score ratios, relative skill scores and p-values. -The following illustrates the pairwise comparison process: - \if{html}{ \out{

} \figure{pairwise-illustration.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Illustration of the pairwise comparison process. + } \if{latex}{ \figure{pairwise-illustration.png} diff --git a/man/illustration-input-metric-binary-point.Rd b/man/illustration-input-metric-binary-point.Rd index 740c9067..605caf37 100644 --- a/man/illustration-input-metric-binary-point.Rd +++ b/man/illustration-input-metric-binary-point.Rd @@ -10,7 +10,8 @@ Illustration of required inputs for binary and point forecasts \if{html}{ \out{

} \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for binary and point forecasts } \if{latex}{ \figure{metrics-binary-point.png} diff --git a/man/illustration-input-metric-nominal.Rd b/man/illustration-input-metric-nominal.Rd index bce6cc36..2136a24a 100644 --- a/man/illustration-input-metric-nominal.Rd +++ b/man/illustration-input-metric-nominal.Rd @@ -10,7 +10,8 @@ Illustration of required inputs for nominal forecasts \if{html}{ \out{

} \figure{metrics-nominal.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for nominal forecasts } \if{latex}{ \figure{metrics-nominal.png} diff --git a/man/illustration-input-metric-quantile.Rd b/man/illustration-input-metric-quantile.Rd index 07d50bac..72df0479 100644 --- a/man/illustration-input-metric-quantile.Rd +++ b/man/illustration-input-metric-quantile.Rd @@ -10,7 +10,8 @@ Illustration of required inputs for quantile-based forecasts \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/illustration-input-metric-sample.Rd b/man/illustration-input-metric-sample.Rd index d7b275c9..ad10a50b 100644 --- a/man/illustration-input-metric-sample.Rd +++ b/man/illustration-input-metric-sample.Rd @@ -10,7 +10,8 @@ Illustration of required inputs for sample-based forecasts \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/interpolate_median.Rd b/man/interpolate_median.Rd index 67e19217..fde28f79 100644 --- a/man/interpolate_median.Rd +++ b/man/interpolate_median.Rd @@ -27,7 +27,8 @@ This is done using linear interpolation between the two innermost quantiles. \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/interval_coverage.Rd b/man/interval_coverage.Rd index 851b66be..5a25b7ad 100644 --- a/man/interval_coverage.Rd +++ b/man/interval_coverage.Rd @@ -39,7 +39,8 @@ predictive distribution. \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/logs_sample.Rd b/man/logs_sample.Rd index f5d71e66..63315837 100644 --- a/man/logs_sample.Rd +++ b/man/logs_sample.Rd @@ -39,7 +39,8 @@ calculating scores for specific discrete probability distributions. \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/mad_sample.Rd b/man/mad_sample.Rd index 10b2a62b..a51c320d 100644 --- a/man/mad_sample.Rd +++ b/man/mad_sample.Rd @@ -35,7 +35,8 @@ and the explanations given in Funk et al. (2019) \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/pit_histogram_sample.Rd b/man/pit_histogram_sample.Rd index 9b1d9f94..3de7fb75 100644 --- a/man/pit_histogram_sample.Rd +++ b/man/pit_histogram_sample.Rd @@ -82,12 +82,14 @@ Values of the PIT histogram are then created by averaging over the \eqn{n} predictions, \deqn{ + \bar{F}(u) = \frac{i = 1}{n} \sum_{i=1}^{n} F^{(i)}(u) } And calculating the value at each bin between quantile \eqn{q_i} and quantile \eqn{q_{i + 1}} as \deqn{ + \bar{F}(q_i) - \bar{F}(q_{i + 1}) } Alternatively, a randomised PIT can be used instead. In this case, the PIT is @@ -96,7 +98,7 @@ Alternatively, a randomised PIT can be used instead. In this case, the PIT is } where \eqn{v} is standard uniform and independent of \eqn{k}. The values of -the PIT histogram are then calculated by binning the $u_t$ values as above. +the PIT histogram are then calculated by binning the \eqn{u_t} values as above. } \examples{ \dontshow{ diff --git a/man/quantile_score.Rd b/man/quantile_score.Rd index 4d585ff1..40df53a5 100644 --- a/man/quantile_score.Rd +++ b/man/quantile_score.Rd @@ -69,7 +69,8 @@ prediction intervals, the quantile score is equivalent to the interval score. \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png} diff --git a/man/scoring-functions-binary.Rd b/man/scoring-functions-binary.Rd index 371f7eab..8bf5cc35 100644 --- a/man/scoring-functions-binary.Rd +++ b/man/scoring-functions-binary.Rd @@ -71,7 +71,8 @@ then you could of course make \code{observed} a factor with levels swapped, i.e. \if{html}{ \out{

} \figure{metrics-binary-point.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for binary and point forecasts } \if{latex}{ \figure{metrics-binary-point.png} diff --git a/man/scoring-functions-nominal.Rd b/man/scoring-functions-nominal.Rd index 377e156e..089a4780 100644 --- a/man/scoring-functions-nominal.Rd +++ b/man/scoring-functions-nominal.Rd @@ -31,7 +31,8 @@ are better (best is zero, worst is infinity). \if{html}{ \out{

} \figure{metrics-nominal.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for nominal forecasts } \if{latex}{ \figure{metrics-nominal.png} diff --git a/man/se_mean_sample.Rd b/man/se_mean_sample.Rd index 71f4a807..dd0527bf 100644 --- a/man/se_mean_sample.Rd +++ b/man/se_mean_sample.Rd @@ -27,7 +27,8 @@ The mean prediction is calculated as the mean of the predictive samples. \if{html}{ \out{

} \figure{metrics-sample.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for sample-based forecasts } \if{latex}{ \figure{metrics-sample.png} diff --git a/man/wis.Rd b/man/wis.Rd index 5452dd23..ebfe7eba 100644 --- a/man/wis.Rd +++ b/man/wis.Rd @@ -162,7 +162,8 @@ WIS components can be computed individually using the functions \if{html}{ \out{

} \figure{metrics-quantile.png}{options: style="width:750px;max-width:100\%;"} - \out{
} + \out{

} + Overview of required input format for quantile-based forecasts } \if{latex}{ \figure{metrics-quantile.png}