I am trying to find multiple seasonality in a stock price time series (GOOG). Converting the double closing price column to an integer complains also. There are no NA's and all of the numbers are positive. Ho do I get rid of this error?
Edit 1: Not using a pipe gets the same warning:
fitClose <- model(close,TSLM(Close ~ trend() + season())) # complains
Original code:
rm(list = ls())
require(fpp3)
goog<-gafa_stock|>filter(Symbol=="GOOG",year(Date)==2018)
close<-goog|>select(Close) # just get close
sum(is.na(close)) # no na's
min(close$Close) # min is positive
fitClose <- close |> model(TSLM(Close ~ trend() + season())) # complains
# Warning message:
# 1 error encountered for TSLM(Close ~ trend() + season())
# [1] argument must be coercible to non-negative integer
c<-close |> mutate(Close=as.integer(Close)) # convert to integer
#autoplot(c)
#close|>mutate(Close = Close / first(Close))
fit <- c |> model(TSLM(Close ~ trend() + season())) # still complains
report(fit)
The tsibble has an irregular time index, as you can see below with the "[!]"
You can re-index it to be daily data (with missing values on non-trading days) using the
as_tsibble()function withregular = TRUE:Created on 2023-06-12 with reprex v2.0.2
season()here has automatically selected weekly seasonality, but due to the missing weekends, two of the seasonal components can't be estimated.In any case, there is no seasonality of any kind in stock prices in an efficient market.