简体   繁体   English

预测R中的多个可变时间序列

[英]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. 我正在尝试使用R预测三个变量,但是我遇到了有关如何处理相关性的问题。

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! 任何帮助是极大的赞赏!

Looks like you can use the vector autoregression (VAR) model. 看起来您可以使用向量自回归(VAR)模型。 Take a look at the description and the code provided here: https://otexts.org/fpp2/VAR.html 查看此处提供的描述和代码: https : //otexts.org/fpp2/VAR.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM