From 80453a2dbf6ffe3149cec4e3059d910d6bb3519d Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Fri, 1 Nov 2024 10:58:39 +0100 Subject: [PATCH] Fix issues with docs --- .gitignore | 1 + R/documentation-templates.R | 12 ++++++++---- R/metrics-quantile.R | 2 +- R/metrics-sample.R | 8 ++++---- R/pairwise-comparisons.R | 6 +++--- man/ae_median_quantile.Rd | 5 +++-- man/ae_median_sample.Rd | 5 +++-- man/bias_quantile.Rd | 3 ++- man/bias_sample.Rd | 3 ++- man/crps_sample.Rd | 3 ++- man/dss_sample.Rd | 3 ++- man/get_metrics.forecast_binary.Rd | 3 ++- man/get_metrics.forecast_point.Rd | 3 ++- man/get_metrics.forecast_quantile.Rd | 3 ++- man/get_metrics.forecast_sample.Rd | 3 ++- man/get_pairwise_comparisons.Rd | 6 +++--- man/illustration-input-metric-binary-point.Rd | 3 ++- man/illustration-input-metric-nominal.Rd | 3 ++- man/illustration-input-metric-quantile.Rd | 3 ++- man/illustration-input-metric-sample.Rd | 3 ++- man/interpolate_median.Rd | 3 ++- man/interval_coverage.Rd | 3 ++- man/logs_sample.Rd | 3 ++- man/mad_sample.Rd | 3 ++- man/pit_histogram_sample.Rd | 4 +++- man/quantile_score.Rd | 3 ++- man/scoring-functions-binary.Rd | 3 ++- man/scoring-functions-nominal.Rd | 3 ++- man/se_mean_sample.Rd | 3 ++- man/wis.Rd | 3 ++- 30 files changed, 71 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 5c2fdb14f..b321ad926 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 77fb9d9fe..66f0c2875 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 2674464fe..c7fcda0ce 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 10f34f1d8..7efb0f3b3 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 f9a26cab1..24e7f6923 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 20c40a9e2..a67507fa1 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 2e2d4b292..985f03280 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 428ba3af8..35f2021e2 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 daedf1804..48e259c25 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 01b1996f8..ec5448d7f 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 906020b8c..5b3bfd13e 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 a9e2ab3ad..09bf9acd6 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 38255ab13..20885785a 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 583968655..75c8974db 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 2a94caa95..bd17bb18b 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 3bc06c557..7b1abbda2 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 740c9067b..605caf374 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 bce6cc366..2136a24a1 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 07d50bac7..72df0479f 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 d7b275c9b..ad10a50ba 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 67e192178..fde28f794 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 851b66bec..5a25b7ad9 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 f5d71e66d..633158374 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 10b2a62b8..a51c320dc 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 9b1d9f94e..3de7fb752 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 4d585ff10..40df53a50 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 371f7eab5..8bf5cc357 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 377e156e0..089a4780c 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 71f4a8075..dd0527bf9 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 5452dd231..ebfe7eba5 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}