Forecasting currencies with ARIMA (error occurred: 'ts' object must have one or more observations)

Viewed 36

Hi I tried to plot future values with ARIMA but this error happened: 'ts' object must have one or more observations.

Import dataset:
library(priceR)
a <- historical_exchange_rates("THB", to = "USD",start_date = "2010-01-01", end_date = "2021-12-31")

Making a timeseries dataset:
library(forecast)
a.dfts <- ts(a$one_THB_equivalent_to_x_USD, frequency=12, start=c(2010,01,01), end=c(2021,12,31))

Apply ARIMA model:
library(TSA)
loga <- diff(log(a.dfts))
finala.arma <- arima(loga, order = c(0,0,2))

Forecasting future values:
forca.ARIMA <- forecast(finala.arma, h=24, level=c(80,95))

Then this is where I got an error. Error in ts(x) : 'ts' object must have one or more observations

0 Answers
Related