
Replace RoC values of zero before fitting a trend
Source:R/util_replace_zero_roc.R
util_replace_zero_roc.RdReplace 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.
Arguments
- data_source
data.framewith anumericcolumnROC, such as the output ofestimate_roc().- silent
logical. IfTRUE, 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.