I am using library(forecast)
to create quarterly forecasts based on quarterly data. My forecasts are saved in a forecast
object. I am trying to find an elegant and simple way of transforming those to the corresponding annual values, taking the mean of all 4 quarters fine.
Is there an option in the forecast
package that allows to do this? Or alternatively, if there a way of transforming the quarterly values?
I tried to convert the forecast
object into a timeseries
object and merge it with the original time series that I used to create the forecasts but that did not work.
Below is an example:
library('quantmod')
library('xts')
library('forecast')
library(zoo)
library(tis)
library(astsa)
library(xts)
GDP_SAAR<-getSymbols('A191RL1Q225SBEA',src='FRED', auto.assign=FALSE)
GDP_SAAR <- ts(GDP_SAAR , start=c(1947, 2), end=c(2017, 3), frequency=4)
fit <- auto.arima(GDP_SAAR)
x<-forecast(fit,h=7)
I do not know if it is still of interest to you, but here is a solution involving 12 steps (quarters) ahead in order to include at least 3 years of aggregated forecasts:
Hope this helps