Hello,
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
library(feasts)
library(dplyr)
library(ggplot2)
library(lubridate)
library(tsibble)
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)
z_eth %>%
autoplot() +
labs(y = "Closing price", x="Date")
switch tsibble to monthly
z_eth_monthly <- z_eth %>% index_by(month = ~ floor_date(.,unit="monthly")) %>% group_by(month) %>% summarise(avgPM= mean(Closing.Price..USD.))
autoplot(z_eth_monthly)
decompose(z_eth_monthly, type="additive")
If I do the following code:
x <- z_eth_monthly %>%
model(stl = STL(avgPM))
components(dcmp)
It return an Null model.