How to change tibble date column?

170 Views Asked by At

So I have this date column in a tibble, which I was going to use for prophet forecasting. The problem is that my timeseries, which contains daily data, shows up in the tibble at 4 minute intervals instead of daily. I have used the time series for other forecasting models so I know there is nothing wrong with the timeseries itself.

My question is: how to change the tibble dates to daily data starting at the first day, so I can forecast 56 days into the future using prophet?

I used the following code, where nn51 is a timeseries with frequency = 365.25.

nn51t <- nn51 %>% 
  tk_tbl() %>% 
  mutate(index = as_date(index)) %>% 
  as_tbl_time(index = index)

nn51t <- nn51t %>% 
  rename(
    ds = index,
    y = value
  )

fit51 <- prophet(nn51t)
future51 <- make_future_dataframe(fit51, periods = 56, freq = 'day')
forecast51 <- predict(fit51, future51)
plot(fit51, forecast51)+ ggtitle("Prophet forecast of NN5_101")

The dates in the tibble look like this: tibble

The data can be downloaded from http://www.neural-forecasting-competition.com/downloads/NN5/datasets/download.htm

0

There are 0 best solutions below