I am dealing with a forecast of time series in R. I have several questions:
- I would like to ask how we can handle missing values in time series?
- I guess we can somehow interpolate them?
- Can you suggest some solution in R for this?
I am dealing with a forecast of time series in R. I have several questions:
One of the solutions imputeTS
library.
library(imputeTS)
# amount of NA
table(is.na(tsAirgap))
# Kalman smoothing imputation (one of the best)
imp_tsAirgap <- na_kalman(tsAirgap)
# Imputed time-series, no NAs
table(is.na(imp_tsAirgap))
If you would like to delete the missing values and their corresponding time-stamps, you can also use the na.remove
function within the tseries
package.