Daniel DE
Daniel DE

Reputation: 95

Forecasting multiple variable time series in R

I am trying to forecast three variables using R, but I am running into issues on how to deal with correlation.

The three variables I am trying to forecast are Revenue, Subscriptions and Price.

My initial approach was to do two independent time series forecast of subscriptions and price and multiply the outcomes to generate the revenue forecast.

I wanted to understand if this approach makes sense, as there is an inherent correlation between the price and the subscribers, and this is the part I do not know how to deal with.

# Load packages.
library(forecast)

# Read data
data <- read.csv("data.csv")
data.train <- data[0:57,]
data.test <- data[58:72,]

# Create time series for variables of interest
data.subs <- ts(data.train$subs, start=c(2014,1), frequency = 12)
data.price <- ts(data.train$price, start=c(2014,1), frequency = 12)

#Create model
subs.stlm <- stlm(data.subs)
price.stlm <- stlm(data.price)

#Forecast
subs.pred <- forecast(subs.stlm, h = 15, level = c(0.6, 0.75, 0.9))
price.pred <- forecast(price.stlm, h = 15, level = c(0.6, 0.75, 0.9))

Any help is greatly appreciated!

Upvotes: 0

Views: 3469

Answers (1)

Prasanna S
Prasanna S

Reputation: 363

Looks like you can use the vector autoregression (VAR) model. Take a look at the description and the code provided here: https://otexts.org/fpp2/VAR.html

Upvotes: 1

Related Questions