I tried to decompose a time series which is saved as a tsibble. I get an error when trying to perform the decompose functions or stl in many syntax variations. The error is: "Time series has no or less then 2 periods".
I have read: 3.1 Transformations and adjustments | Forecasting: Principles and Practice (3rd ed),
My used data set is this: Ethereum Price | ETH Price Index and Live Chart — CoinDesk 20 - All and then export as .csv
csv_data_1 <- read.csv("ETH_USD_CoinDesk.csv")
z_eth <- mutate(csv_data_1, Currency = NULL, X24h.High..USD. = NULL, X24h.Low..USD.=NULL, X24h.Open..USD.=NULL) %>%
mutate(Date = ymd(Date)) %>% as_tsibble(index = Date)
labs(y = "Closing price", x="Date")
z_eth_monthly <- z_eth %>% index_by(month = ~ floor_date(.,unit="monthly")) %>% group_by(month) %>% summarise(avgPM= mean(Closing.Price..USD.))
If I do the following code:
x <- z_eth_monthly %>%
model(stl = STL(avgPM))
It return an Null model.