I have a physical time series in a range of 2 year sample data with a frequency of 30 minutes, but there are multiple and wide lost data intervals as you can see there:
I tried with the function na.interp
from forecast
package with a bad result (shown above):
sapply(dataframeTS[2:10], na.interp)
Im looking for a more useful method.
UPDATE:
Here is more info about the pattern I want to capture, concretely the row data
. This subsample belongs to May.
You might want to try the **imputeTS**
package. It's an R package dedicated to time series missing value imputation.
The na_seadec()
, na_seasplit()
, na_kalman()
methods might be interesting here
There are many more algorithm options - you can find a list in this Paper about the package.
In this specific case I would try:
na_seasplit(yourData)
or
na_kalman(yourData)
or
na_seadec(yourData)
Be aware, that it might be you need to give the seasonality information correctly with the time series. (you have to create a time series (ts
object) and set the frequency
parameter)
Still might be that it won't work out at all, you will have to try. (if you can provide the data I'll also give it a try)