anomalize icon indicating copy to clipboard operation
anomalize copied to clipboard

time_decompose with missing values

Open cdeterman opened this issue 6 years ago • 1 comments

My dataset is much larger but this error is trivially reproduced with the following sample data.

tmp <- structure(list(ds = structure(c(16482, 16483, 16484, 16485, 16486, 
16487), class = "Date"), y = c(2.16618784530387, NA, NA, 1.95971962616822, 
NA, NA)), .Names = c("ds", "y"), row.names = c(NA, -6L), class = c("tbl_df", 
"tbl", "data.frame"))

Obviously there are NA values. I have been using the prophet package to build some forecast models which handles NA values without an issue. There are likely outliers in my datasets that I would like to leverage anomalize. However, there are various NA values that cause an error to be through with the first time_decompose function. For example

tmp %>%
  time_decompose(y)

Converting from tbl_df to tbl_time. Auto-index message: index = ds frequency = 1 days trend = 6 days Error in na.fail.default(as.ts(x)) : missing values in object

Thoughts on how to address this?

cdeterman avatar Nov 05 '18 16:11 cdeterman

I've been having the same problem. Has anyone found a solution?

srgorelik avatar Feb 06 '23 18:02 srgorelik