Closed morris25 closed 3 years ago
I think this should be implemented with a limit
keyword to the existing LOCF
, NOCB
and Interpolate
methods.
The desired behavour of the original implementation (which was written some long time ago in Matlab) is to not impute at all if the gap is longer than (e.g.) 1 hour. The alternative behavour is to impute only up to the limit entries So impute the first hour of a n-hour gap.
I agree that the alternative makes sense. But tests would have to be run to see that it doesn't cause regressions in final result for our systems that use this.
Adds a limited version of LOCF that only fills gaps smaller than a certain size.
The code this comes from has a number of broken tests that display slightly different behaviour. It is unknown whether this is desired behaviour that wasn't implemented or just differences between versions. The behaviour in those tests is to fill in up to
max_gap_size
values and leave any remainingmissing
s.This is what the alternative behaviour would look like.