I am attempting to impute NA values in a univariate time series using the imputeTS package in R and I have noticed something strange when I try to do the imputation by Kalman smoothing using na_kalman().
My data is daily average temperature data so it is similar to the pseudo data in the code below, which simulates 2 years of numerical data with NA's:
tseries=ts(sample(c(1:10,NA),730,replace = TRUE),start = 1990,frequency = 365)
Now for the strange part: I have noticed that if I try to pass this time series to the na_kalman() function, it seems to always crash my R session.
library(imputeTS)
kal.imp<-na_kalman(tseries) #fails
However, if I use the same data as either a numerical vector or a time series with frequency 1, it seems to work just fine. This seems to suggest that the problem is the frequency of the time series, for some reason.
This also seems to happen if I try to use Kalman smoothing as an option for na_seadec(), regardless of whether find_frequency is TRUE of FALSE:
sd.kal.imp.false<-na_seadec(tseries, algorithm = "kalman", find_frequency = FALSE)#fails
sd.kal.imp.true<-na_seadec(tseries, algorithm = "kalman", find_frequency = TRUE) #also fails
Can anyone help me understand why this is happening?