forecasting

Issues with simulating a seasonal ARIMA model

你说的曾经没有我的故事 提交于 2019-12-07 03:53:59
问题 I am trying to generate simulations from a seasonal arima model using the forecast package in R via the following command: simulate(model_temp) where model_temp is the result of applying the arima() function to my observed time series, and with which, incidentally, I specified the model to be an ARIMA(2,1,2)(0,1,2)[12] model. However, when I attempt this, I get the following error: Error in diffinv.vector(x, lag, differences, xi) : NA/NaN/Inf in foreign function call (arg 1) Can anybody

Package install error: compilation failed

十年热恋 提交于 2019-12-07 03:21:05
问题 I recently updated R to 3.1.0. I tried to move my packages over to 3.1 inside the R.Framework (I'm running OSX Mavericks) and somehow made a mess of it, so did a complete uninstall of everything before a clean install. When reinstalling packages I had no issues until I hit the forecast package which yields the following error: package ‘forecast’ is available as a source package but not as a binary Warning in install.packages : package ‘forecast’ is not available (for R version 3.1.0) I

Training an LSTM neural network to forecast time series in pybrain, python

与世无争的帅哥 提交于 2019-12-06 17:28:17
I have a neural network created using PyBrain and designed to forecast time series. I am using the sequential dataset function, and trying to use a sliding window of 5 previous values to predict the 6th. One of my problems is that I can't figure out how to create the required dataset by appending the 5 previous values to the inputs and the 6th as an output. I am also unsure of how exactly to forecast values in the series once the network is trained. Posting my code below: from pybrain.datasets import SupervisedDataSet from pybrain.datasets import SequentialDataSet from pybrain.tools.shortcuts

forecast v7 & ggplot2 graphics adding fitted line to autoplot

天涯浪子 提交于 2019-12-06 10:29:34
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? 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 your ts into a data frame where you can use normal ggplot command. You can then just add the line. I realized

error in stl, series has less than two periods (erroneous?)

雨燕双飞 提交于 2019-12-06 08:41:41
I have two years of monthly data but stl() seems to need a minimum of two years and one month . Here are two simple examples: Example 1 - returns Error in stl(x, "periodic") : series is not periodic or has less than two periods dat_24 <- cumsum(rnorm(24)) x_24 <- ts(dat_24, frequency = 12) stl(x_24, "periodic") Example 2 - returns forecast as expected dat_25 <- cumsum(rnorm(25)) x_25 <- ts(dat_25, frequency = 12) stl(x_25, "periodic") Shouldn't I be able to get a forecast with only 24 numbers with frequency = 12? It holds true for all kind of periodic series, be it a weekly or yearly or any

JFreechart(Java) - How to draw lines that is partially dashed lines and partially solid lines?

元气小坏坏 提交于 2019-12-06 04:38:23
问题 I'm going to plot a line chart that will change from solid line to dashed line to to indicate real data and forecasting data. I'm not sure if i need to extend some of the classes like XYLineAndShapeRenderer or something else, or maybe there is some convenient way to achieve this? Here is a demostration graph i plotted using Excel. I am talking about the gray lines in the graph. That is what i want. I don't know if there is a renderer that allow me to indicate which range dashed or solid 回答1:

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

非 Y 不嫁゛ 提交于 2019-12-06 01:46:49
问题 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 =>

R Forecasting with as.POSIXlt/ct

北战南征 提交于 2019-12-05 22:17:37
Good day I read on one of the posts here that "the function forecast::plot.forecast is not designed to be used with axis.Date or axis.POSIXct (which are not used in the package forecast)." This can be seen here: custom axis labels plotting a forecast in R Nevertheless, they managed to use the forecast package and some code to get the correct axis labels. However, this example is for quarterly data. Also, this example here using 'as.POSIXlt' is for weekly data: Forecasting time series data I've tried playing with the code but I can't get it to work for monthly data. So my axis labels are still

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

守給你的承諾、 提交于 2019-12-05 14:04:37
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, method='comb', fmethod='MAPA') However, it is unclear to me if / how I can combine the two, since forecast.gts() only accepts fmethod=c("ets", "arima", "rw"). Is there a clever way to pass different forecasting methods to

How to invert differencing in a Python statsmodels ARIMA forecast?

倖福魔咒の 提交于 2019-12-05 12:03:48
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 the example in the last chapter of Mastering Python Data Analysis , Magnus Vilhelm Persson; Luiz