forecasting

Hierarchical Time Series

只谈情不闲聊 提交于 2019-12-01 13:53:54
问题 I used the hts package in R to fit an HTS model on train data, used "arima" option to forecast and computed the accuracy on the holdout/test data. Here is my code: library(hts) data<-read.csv("C:/TS.csv") ts_train <- ts(data[,-1],frequency=12, start=c(2000,1)) hts_train <- hts(ts_train, nodes=list(2, c(4, 2))) data.test<-read.csv("C:/TStest.csv") ts_test <- ts(data.test[,-1],frequency=12, start=c(2003,1)) hts_test <- hts(ts_test, nodes=list(2, c(4, 2))) forecast <- forecast(hts_train, h=15,

ARIMA forecasting with auto.Arima() and xreg

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 23:27:22
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 saying: Error in model.frame.default(formula = x ~ xreg, drop.unused.levels = TRUE) : variable lengths

Forecast accuracy: no MASE with two vectors as arguments

早过忘川 提交于 2019-11-30 20:16:03
I'm using the accuracy function from the forecast package, to calculate accuracy measures. I'm using it to calculate measures for fitted time series models, such as ARIMA or exponential smoothing. As I'm testing different model types on different dimensions and aggregation levels, I'm using the MASE, mean absolute scaled error, introduced by Hyndman et al (2006, "Another look at measures of forecast accuracy"), to compare different models on different levels. Now I'm also comparing models with forecast history. As I only have the forecast values and not the models, I tried to use the accuracy

R, Times Series, Arima Model, Forecasting, Daily data [closed]

非 Y 不嫁゛ 提交于 2019-11-30 14:18:57
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am trying to do some demand forecasting with daily data, from jan 16, 2012 to Oct 10, 2013. But the forecasting just returns awful results. Any clue why? This is how the data looks like in a plot: There are weekly and monthly seasonalities exist. Ie: More demand during weekday and less demand during the

PCA: How does princomp() work and can I use it to pick up variables for ARIMA?

霸气de小男生 提交于 2019-11-30 13:06:11
问题 I'm trying to use PCA to pick good predictors to use in the xreg argument of an arima model to try to forecast the tVar variable below. I am just using the reduced dataset below with just a few variables to make the example simple. I am trying to understand how the formula argument in princomp works. For the pc object below, is it saying "use xVar1 and xVar2 to explain the variance in na.omit(dfData[,c("tVar","xVar1","xVar2")]) " ? What I ultimately would like to do is create a new variable

R, Times Series, Arima Model, Forecasting, Daily data [closed]

好久不见. 提交于 2019-11-30 10:11:57
I am trying to do some demand forecasting with daily data, from jan 16, 2012 to Oct 10, 2013. But the forecasting just returns awful results. Any clue why? This is how the data looks like in a plot: There are weekly and monthly seasonalities exist. Ie: More demand during weekday and less demand during the weekend. Here is how the prediction plot looks: where the black line is the actual data and blue line is the predicted data. x = ts(data, freq=7, start=c(3,2)) fit <- auto.arima(x) pred <- forecast(fit, h=300) I did a lot of research on how to fit daily data with arima model. And since there

How to use tensorflow seq2seq without embeddings?

南楼画角 提交于 2019-11-30 10:07:18
I have been working on LSTM for timeseries forecasting by using tensorflow. Now, i want to try sequence to sequence (seq2seq). In the official site there is a tutorial which shows NMT with embeddings . So, how can I use this new seq2seq module without embeddings? (directly using time series "sequences"). # 1. Encoder encoder_cell = tf.contrib.rnn.BasicLSTMCell(LSTM_SIZE) encoder_outputs, encoder_state = tf.nn.static_rnn( encoder_cell, x, dtype=tf.float32) # Decoder decoder_cell = tf.nn.rnn_cell.BasicLSTMCell(LSTM_SIZE) helper = tf.contrib.seq2seq.TrainingHelper( decoder_emb_inp, decoder

PCA: How does princomp() work and can I use it to pick up variables for ARIMA?

不羁岁月 提交于 2019-11-30 05:31:52
I'm trying to use PCA to pick good predictors to use in the xreg argument of an arima model to try to forecast the tVar variable below. I am just using the reduced dataset below with just a few variables to make the example simple. I am trying to understand how the formula argument in princomp works. For the pc object below, is it saying "use xVar1 and xVar2 to explain the variance in na.omit(dfData[,c("tVar","xVar1","xVar2")]) " ? What I ultimately would like to do is create a new variable which explains most of the variance in tVar . Is that something I can do using PCA? If so, could someone

How to use tensorflow seq2seq without embeddings?

一世执手 提交于 2019-11-29 15:13:48
问题 I have been working on LSTM for timeseries forecasting by using tensorflow. Now, i want to try sequence to sequence (seq2seq). In the official site there is a tutorial which shows NMT with embeddings . So, how can I use this new seq2seq module without embeddings? (directly using time series "sequences"). # 1. Encoder encoder_cell = tf.contrib.rnn.BasicLSTMCell(LSTM_SIZE) encoder_outputs, encoder_state = tf.nn.static_rnn( encoder_cell, x, dtype=tf.float32) # Decoder decoder_cell = tf.nn.rnn

Using Prophet Package to Predict By Group in Dataframe in R

ε祈祈猫儿з 提交于 2019-11-28 18:58:35
I am using the new package released from Facebook called Prophet. It does time series predictions and I want to apply this function By Group. Scroll down to R Section. https://facebookincubator.github.io/prophet/docs/quick_start.html This is my attempt: grouped_output = df %>% group_by(group) %>% do(m = prophet(df[,c(1,3)])) %>% do(future = make_future_dataframe(m, period = 7)) %>% do(forecast = prophet:::predict.prophet(m, future)) grouped_output[[1]] I then need to extract the results from the list of each group which I am having trouble doing. Below is my original dataframe without the