forecasting

Using forecast.gts (package hts) with external regressor and parallel processing

≯℡__Kan透↙ 提交于 2019-12-10 12:15:28
问题 I'm currently using the hts package to forecast (forecast.gts) . I'm now interested in running it in parallel, using the num.cores argument. but when i'm adding an external regressor (using the xreg and newxreg parameters) im getting the following error: Error in checkForRemoteErrors(val) Example with data: library(ggplot2) library(plyr) library(hts) library(ts) library(data.table) library(reshape2) horizon<-30 data1<-dcast(data, Date ~ Brand+Venue, sum , value.var="Spend") data[is.na(data)]

Do we need to do differencing of exogenous variables before passing to xreg argument of Arima() in R?

与世无争的帅哥 提交于 2019-12-10 11:38:22
问题 I am trying to build a forecasting model using ARIMAX in R and require some guidance on how covariates are handled in xreg argument. I understand that, auto.arima function takes care of differencing of covariates while fitting the model (from training period data) and I also don't need to difference the covariates for generating forecasts for test period (future values). However, while fitting the model using Arima() in R with custom (p, d, q) and (P, D, Q)[m] values with d or D greater than

How to invert differencing in a Python statsmodels ARIMA forecast?

不问归期 提交于 2019-12-10 07:33:00
问题 I'm trying to wrap my head around ARIMA forecasting using Python and Statsmodels. Specifically, for the ARIMA algorithm to work, the data needs to be made stationary via differencing (or similar method). The question is: How does one invert the differencing after the residual forecast has been made to get back to a forecast including the trend and seasonality that was differenced out? (I saw a similar question here but alas, no answers have been posted.) Here's what I've done so far (based on

R: applying Holt Winters by group of columns to forecast time series

陌路散爱 提交于 2019-12-10 04:31:57
问题 I have a time series data with a frequency = 7 as follows: combo_1_daily_mini <- read.table(header=TRUE, text=" region_1 region_2 region_3 date incidents USA CA San Francisco 1/1/15 37 USA CA San Francisco 1/2/15 30 USA CA San Francisco 1/3/15 31 USA CA San Francisco 1/4/15 33 USA CA San Francisco 1/5/15 28 USA CA San Francisco 1/6/15 33 USA CA San Francisco 1/7/15 39 USA PA Pittsburg 1/1/15 38 USA PA Pittsburg 1/2/15 35 USA PA Pittsburg 1/3/15 37 USA PA Pittsburg 1/4/15 33 USA PA Pittsburg 1

What's the gaps for the forecast error metrics: MAPE and WMAPE?

老子叫甜甜 提交于 2019-12-09 18:33:46
问题 I know that MAPE and WMAPE as a forecast error metrics, they have some benefits. But what's the gaps? Someone says: For MAPE: "Combinations with very small or zero volumes can cause large skew in results" And for WMAPE: "Combinations with large weights can skew the results in their favor" I can't understand, can anyone explain the two statements for the weakness of the two metrics? Thanks. 回答1: For MAPE, Mean absolute percentage error [1], suppose we denote the actual value with A , and

Function for testing system stability, which receives predicted time series as input

陌路散爱 提交于 2019-12-08 16:23:29
问题 I want to write a function that gets a time series and a standard deviation as parameters and returns an adjusted time series which looks like a forecast. With this function I want to test a system for stability, which gets a forecasted time series list for weather as input parameter. My approach for such a function, which is described below: vector<tuple<datetime, double>> get_adjusted_timeseries(vector<tuple<datetime, double>>& timeseries_original, const double stddev, const double dist_mid

Timeseries Crossvalidation in R: using tsCV() with tslm()-Models

六眼飞鱼酱① 提交于 2019-12-08 07:16:48
问题 I am currently trying to evaluate a tslm-model using timeseries cross validation. I want to use a fixed model (without parameter reestimation) an look at the 1 to 3 step ahead horizon forecasts for the evaluation period of the last year. I have trouble to get tsCV and tslm from the forecast-library to work well together. What am I missing? library(forecast) library(ggfortify) AirPassengers_train <- head(AirPassengers, 100) AirPassengers_test <- tail(AirPassengers, 44) ## Holdout Evaluation n

Timeseries Crossvalidation in R: using tsCV() with tslm()-Models

99封情书 提交于 2019-12-08 04:41:27
I am currently trying to evaluate a tslm-model using timeseries cross validation. I want to use a fixed model (without parameter reestimation) an look at the 1 to 3 step ahead horizon forecasts for the evaluation period of the last year. I have trouble to get tsCV and tslm from the forecast-library to work well together. What am I missing? library(forecast) library(ggfortify) AirPassengers_train <- head(AirPassengers, 100) AirPassengers_test <- tail(AirPassengers, 44) ## Holdout Evaluation n_train <- length(AirPassengers_train) n_test <- length(AirPassengers_test) pred_train <- ts(rnorm(n

forecast v7 & ggplot2 graphics adding fitted line to autoplot

£可爱£侵袭症+ 提交于 2019-12-07 23:41:51
问题 I was looking through a tutorial by Rob J Hyndman, here's the link for the tutorial, my question is how can i add a fitted line to the forecast plot eg; library(forecast) library(ggplot2) fc <- forecast(fdeaths) autoplot(fc) I now need to add fitted(fc) to the plot above, how do I do it? 回答1: Here an other solution without additional packages: fit <- data.frame(data=as.matrix(fitted(fc)), date=time(fitted(fc))) autoplot(fc) + geom_line(data = fit,aes(date,data), col = "red") You transform

Passing different forecasting method to hierarchical time series forecast in R?

时光总嘲笑我的痴心妄想 提交于 2019-12-07 04:18:50
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 4 years ago . I have a hierarchical time series, the bottom level series of which all exhibit intermittent demand. It seems advantageous to use Hyndman's HTS package for optimal combination within the hierarchy. It also seems advantageous to use Kourentzes' MAPA package for multiple aggregation prediction of the intermittent demand. In essence, I want to do something like: forecast(my_hts,