Reputation: 184
I'm analyzing time series data which is based on a data frame that has dates, products, and price. In the data frame, it gives price of each product for each date. I am trying to forecast the price of each product using ARIMA.
I've made multiple sub-dataframes for each product and ran auto.arima()
to find the AR and MA of the time series data of each product. I found out that each product has different AR and MA.
What I'm trying to do is making a loop that runs for the number of products and forecast the price of each product a week ahead. Since each product data has different outputs from auto.arima()
, I need a function that assigns the output from auto.arima()
to three variables (one for AR, one for MA, and one for difference order). How can I do this?
Thank you in advance!
Upvotes: 0
Views: 154
Reputation: 3269
a <- auto.arima(mtcars$qsec)
Use forecast::arimaorder(a)
to extract AR, I, MA terms.
# p d q
# 0 1 1
Upvotes: 1