Open
Description
Dear team,
There is a function in timetk ts_impute_vec
which is useful for imputing missing or outlier values in time series. The function uses linear interpolation which is a bit subjective at times as it will give extreme values if the data has outliers. My recommendation is you also consider other forms of interpolation like the spline interpolation which comes in handy in cases where the continuity of the time series curvature is important.
Current anyone interested in spline interpolation implement via library(zoo)
as below
library(zoo)
ts_data %>%
# Via spline interpolation
mutate(value_spline=ifelse(is.na(value),na.spline(value),value))%>%
# Or the below using ys_impute vec
mutate(value_linear=ifelse(is.na(value),ts_impute_vec(value,period=1),value))
Metadata
Assignees
Labels
No labels
Activity