Takes in a reporting triangle and returns it with negative values of
reporting handled by redistributing them to earlier delays (from longer
delay to shorter). This is useful when dealing with reporting corrections
that can result in negative incremental counts.
When negative values are detected, they are set to zero and the negative
amount is subtracted from the count at the next earlier delay (moving from
right to left in each row). This process continues until either the
negative value is fully absorbed or the first delay is reached.
This code was adapted from code written (under an MIT license)
by the Karlsruhe Institute of Technology RESPINOW
German Hospitalization Nowcasting Hub.
Modified from https://github.com/KITmetricslab/RESPINOW-Hub/blob/main/code/baseline/functions.R #nolint