Learn R Programming

scoringutils (version 1.2.2)

log_shift: Log transformation with an additive shift

Description

Function that shifts a value by some offset and then applies the natural logarithm to it.

Usage

log_shift(x, offset = 0, base = exp(1))

Value

A numeric vector with transformed values

Arguments

x

vector of input values to be transformed

offset

number to add to the input value before taking the natural logarithm

base

a positive or complex number: the base with respect to which logarithms are computed. Defaults to e = exp(1).

Details

The output is computed as log(x + offset)

References

Transformation of forecasts for evaluating predictive performance in an epidemiological context Nikos I. Bosse, Sam Abbott, Anne Cori, Edwin van Leeuwen, Johannes Bracher, Sebastian Funk medRxiv 2023.01.23.23284722 tools:::Rd_expr_doi("https://doi.org/10.1101/2023.01.23.23284722") https://www.medrxiv.org/content/10.1101/2023.01.23.23284722v1 # nolint

Examples

Run this code
log_shift(1:10)
log_shift(0:9, offset = 1)

transform_forecasts(
  example_quantile[true_value > 0, ],
  fun = log_shift,
  offset = 1
 )

Run the code above in your browser using DataLab