Skip to contents

Replace RoC values of zero by half of the smallest RoC value above zero, so that a trend with a Gamma distribution (Tweedie with power 2), which is defined only for values above zero, can be fitted. RoC is zero between two Working Units with identical composition, for example after smoothing.

Usage

util_replace_zero_roc(data_source, silent = FALSE)

Arguments

data_source

data.frame with a numeric column ROC, such as the output of estimate_roc().

silent

logical. If TRUE, do not warn about replaced values (default = FALSE).

Value

data_source with each value of zero in ROC replaced by half of the smallest value of ROC above zero. All other values and columns are unchanged. With silent = FALSE, a warning gives the number of replaced values and the value that replaced them.

Details

Use the result only to fit the trend; compare peaks with the original ROC values. The function stops with an error when ROC has no value above zero, because no trend can then be fitted.