forecasting

How to use ‘hts’ with multi-level hierarchies?

不问归期 提交于 2019-12-04 07:59:43
I am forecasting on a large set of time series (5,000+). I would like to do this with a hierarchical approach were I do the forecasting at a higher level and then allocate the forecast down to each SKU. I see a need for doing this in order to zoom into a lower geographic level of detail, while doing the forecasting on a higher level (top-down). For example, below you see a sample of the structure that I am thinking about. Total => Europe => Netherlands => RegionA => Client_A_in_Netherlands => SKU1 => SKU2 => SKU3 => Client_Q_in_Netherlands => SKU15 => Germany1 => (...) => ClientY_in_Germany =>

Forecasting Values are coming same in R

≡放荡痞女 提交于 2019-12-03 21:38:15
I have one sample data Sno period year_quarter country city sales_revenue 1 1/1/2009 2009-Q1 Argentina Buenos Aires 3008 2 1/4/2009 2009-Q2 Argentina Buenos Aires 3244 3 1/7/2009 2009-Q3 Argentina Buenos Aires 8000 4 1/10/2009 2009-Q4 Argentina Buenos Aires 8719 5 1/1/2010 2010-Q1 Argentina Buenos Aires 3008 6 1/4/2010 2010-Q2 Argentina Buenos Aires 3244 7 1/7/2010 2010-Q3 Argentina Buenos Aires 78 8 1/10/2010 2010-Q4 Argentina Buenos Aires 7379 9 1/1/2011 2011-Q1 Argentina Buenos Aires 3735 10 1/4/2011 2011-Q2 Argentina Buenos Aires 7339 11 1/7/2011 2011-Q3 Argentina Buenos Aires 17240 12 1

ARIMA forecasting with auto.Arima() and xreg

放肆的年华 提交于 2019-12-03 21:30:58
问题 I am working on project to forecast sales of stores to learn forecasting.Till now I have successfully used simple auto.Arima() function for forecasting.But to make these forecast more accurate I can make use of covariates.I have defined covariates like holidays, promotion which affect on sales of store using xreg operator with the help of this post: How to setup xreg argument in auto.arima() in R? But my code fails at line: ARIMAfit <- auto.arima(saledata, xreg=covariates) and gives error

Is there a way to force seasonality from auto.arima

岁酱吖の 提交于 2019-12-03 14:40:12
With the forecast package, I have a time series that I would like ?auto.arima to automatically pick the orders but I would like to coerce seasonality. The defaults for the function allow for the seasonal argument to be set to TRUE , but that only allows the option for seasonality not a coercion. auto.arima(x, d=NA, D=NA, max.p=5, max.q=5, max.P=2, max.Q=2, max.order=5, max.d=2, max.D=1, start.p=2, start.q=2, start.P=1, start.Q=1, stationary=FALSE, seasonal=TRUE, ic=c("aicc", "aic", "bic"), stepwise=TRUE, trace=FALSE, approximation=(length(x)>100 | frequency(x)>12), xreg=NULL, test=c("kpss",

Forecast with ggplot2 and funggcast function

微笑、不失礼 提交于 2019-12-03 13:58:58
问题 On this website, Mr. Davenport published a function to plot an arima forecast with ggplot2 on the example of an arbitrary dataset, he published here. I can follow his example without any error message. Now, when I use my data, I would end with the warning: 1: In window.default(x, ...) : 'end' value not changed 2: In window.default(x, ...) : 'end' value not changed I know that it happens when I call this command pd <- funggcast(yt, yfor) due to an issue with the data I indicate in my data end

Gaussian Process scikit-learn - Exception

孤街浪徒 提交于 2019-12-03 13:34:16
I want to use Gaussian Processes to solve a regression task. My data is as follow : each X vector has a length of 37, and each Y vector has a length of 8. I'm using the sklearn package in Python but trying to use gaussian processes leads to an Exception : from sklearn import gaussian_process print "x :", x__ print "y :", y__ gp = gaussian_process.GaussianProcess(theta0=1e-2, thetaL=1e-4, thetaU=1e-1) gp.fit(x__, y__) x : [[ 136. 137. 137. 132. 130. 130. 132. 133. 134. 135. 135. 134. 134. 1139. 1019. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 70. 24. 55. 0. 9. 0. 0.] [ 136. 137. 137. 132. 130

Forecasting with statsmodels

痞子三分冷 提交于 2019-12-03 13:18:30
I have a .csv file containing a 5-year time series, with hourly resolution (commoditiy price). Based on the historical data, I want to create a forecast of the prices for the 6th year. I have read a couple of articles on the www about these type of procedures, and I basically based my code on the code posted there, since my knowledge in both Python (especially statsmodels) and statistic is at most limited. Those are the links, for those who are interested: http://www.seanabu.com/2016/03/22/time-series-seasonal-ARIMA-model-in-python/ http://www.johnwittenauer.net/a-simple-time-series-analysis

Iteratively forecasting dyn models

大兔子大兔子 提交于 2019-12-03 08:45:51
I've written a function to iteratively forecast models built using the package dyn, and I'd like some feedback on it. Is there a better way to do this? Has someone written canonical "forecast" methods for the dyn class (or dynlm class), or am I venturing into uncharted territory here? ipredict <-function(model, newdata, interval = "none", level = 0.95, na.action = na.pass, weights = 1) { P<-predict(model,newdata=newdata,interval=interval, level=level,na.action=na.action,weights=weights) for (i in seq(1,dim(newdata)[1])) { if (is.na(newdata[i])) { if (interval=="none") { P[i]<-predict(model

Holt-Winters time series forecasting with statsmodels

帅比萌擦擦* 提交于 2019-12-03 07:03:05
I tried forecasting with holt-winters model as shown below but I keep getting a prediction that is not consistent with what I expect. I also showed a visualization of the plot Train = Airline[:130] Test = Airline[129:] from statsmodels.tsa.holtwinters import Holt y_hat_avg = Test.copy() fit1 = Holt(np.asarray(Train['Passengers'])).fit() y_hat_avg['Holt_Winter'] = fit1.predict(start=1,end=15) plt.figure(figsize=(16,8)) plt.plot(Train.index, Train['Passengers'], label='Train') plt.plot(Test.index,Test['Passengers'], label='Test') plt.plot(y_hat_avg.index,y_hat_avg['Holt_Winter'], label='Holt

How to use tf.contrib.seq2seq.Helper for non-embedding data?

人走茶凉 提交于 2019-12-03 05:17:58
问题 I'm trying to use tf.contrib.seq2seq module to do forecasting on some data (just float32 vectors) but all the examples I found using the seq2seq module from TensorFlow are used for translation and therefore embeddings. I'm struggling to understand exactly what tf.contrib.seq2seq.Helper is doing for the Seq2Seq architecture and how I can use the CustomHelper in my case. This is what I've done for now: import tensorflow as tf from tensorflow.python.layers import core as layers_core input_seq