r - Vector Autoregressive Models for Multivariate Time Series : Trend and Seasonality -
i have 3 time series , want predict future values each of them. using vars! package in r.
so approach:
decompose multiplicative time series , take out trend, seasonality, , random part.
time_series1_components = decompose(time_series1,type="mult")
do time series.
apply var model on random parts , predict future values:
random_part1 = time_series1_components$random random_part2 = time_series2_components$random random_part3 = time_series3_components$random merged_df = ts.union(random_part1, random_part2,random_part3, dframe = true) merged_mat <- data.matrix(merged_df) merged_mat = na.exclude(merged_mat) checklag = varselect(merged_mat) estimatemodel=var(merged_mat, p = 2, type = "const", season = null, exogen = null) summary(estimatemodel) roots(estimatemodel) predict(estimatemodel)`
now, should combine predicted values of random part trend , seasonality. , plot graph showing past values , predicted values (highlighted separately). how can achieve this? pointers helpful.
Comments
Post a Comment