forecasting

How to create a forecast object in R [closed]

北城余情 提交于 2019-12-21 23:44:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I have wrote a function that forecasts a time series object using different forecast methods like forecast::nnetar , forecast::tbats , forecast::Arima and forecast::ets . I know that forecastHybrid::hybridModel function is doing this, I just wanted to create something more

error in stl .series is not periodic

落花浮王杯 提交于 2019-12-21 21:28:13
问题 I am pretty sure I am missing something which is very simple but still not able to figure out why this error is showing up . The data I have is of every month end data from 2013 Apr to 2014 Mar. Now I want to understand the trend over the 12 months period . xx <- structure(c(41.52, 41.52, 41.52, 41.68, 41.68, 41.68, 41.84, 41.84, 41.84, 42.05, 42.05, 42.05), .Tsp = c(2013.25, 2014.16666666667, 12), class = "ts"); is my time series data . Now when I use stl(xx,s.window ="periodic") I get error

Is it possible to do multivariate multi-step forecasting using FB Prophet?

梦想的初衷 提交于 2019-12-21 20:24:27
问题 I'm working on a multivariate (100+ variables) multi-step (t1 to t30) forecasting problem where the time series frequency is every 1 minute. The problem requires to forecast one of the 100+ variables as target. I'm interested to know if it's possible to do it using FB Prophet's Python API. I was able to do it in a univariate fashion using only the target variable and the datetime variable. Any help and direction is appreciated. Please let me know if any further input or clarity is needed on

Prophet Forecasting using R for multiple items

旧城冷巷雨未停 提交于 2019-12-21 05:39:30
问题 I am very new to time series forecasting using Prophet in R. I am able to predict values for one single product using Prophet. Is there any way if i can use loop to generate forecast using Prophet for multiple products? The below code works absolutely fine for single product but i am trying to generate forecasts for multiple products library(prophet) df <- read.csv("Prophet.csv") df$Date<-as.Date(as.character(df$Date), format = "%d-%m-%Y") colnames(df) <- c("ds", "y") m <- prophet(df) future

Iteratively forecasting dyn models

五迷三道 提交于 2019-12-21 03:10:11
问题 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

For loop for forecasting several datasets at once in R

筅森魡賤 提交于 2019-12-21 02:58:11
问题 I have a dataset with "Time, Region, Sales" variables and I want to forecast sales for each region using ARIMA or ETS(SES) using library(forecast) . There are a total of 70 regions and all of them have 152 observations each and (3 years of data). Something like this: Week Region Sales 01/1/2011 A 129 07/1/2011 A 140 14/1/2011 A 133 21/1/2011 A 189 ... ... ... 01/12/2013 Z 324 07/12/2013 Z 210 14/12/2013 Z 155 21/12/2013 Z 386 28/12/2013 Z 266 So, I want R to treat every region as a different

Time series prediction using R

不羁岁月 提交于 2019-12-20 14:12:28
问题 I have the following R code library(forecast) value <- c(1.2, 1.7, 1.6, 1.2, 1.6, 1.3, 1.5, 1.9, 5.4, 4.2, 5.5, 6, 5.6, 6.2, 6.8, 7.1, 7.1, 5.8, 0, 5.2, 4.6, 3.6, 3, 3.8, 3.1, 3.4, 2, 3.1, 3.2, 1.6, 0.6, 3.3, 4.9, 6.5, 5.3, 3.5, 5.3, 7.2, 7.4, 7.3, 7.2, 4, 6.1, 4.3, 4, 2.4, 0.4, 2.4) sensor<-ts(value,frequency=24) fit <- auto.arima(sensor) LH.pred<-predict(fit,n.ahead=24) plot(sensor,ylim=c(0,10),xlim=c(0,5),type="o", lwd="1") lines(LH.pred$pred,col="red",type="o",lwd="1") grid() The

How to handle Shift in Forecasted value

爱⌒轻易说出口 提交于 2019-12-20 10:23:52
问题 I implemented a forecasting model using LSTM in Keras. The dataset is 15mints seperated and I am forecasting for 12 future steps. The model performs good for the problem. But there is a small problem with the forecast made. It is showing a small shift effect. To get a more clear picture see the below attached figure. How to handle this problem.? How the data must be transformed to handle this kind of issue.? The model I used is given below init_lstm = RandomUniform(minval=-.05, maxval=.05)

Explaining the forecasts from an ARIMA model

大兔子大兔子 提交于 2019-12-20 08:31:18
问题 I am trying to explain to myself the forecasting result from applying an ARIMA model to a time-series dataset. The data is from the M1-Competition, the series is MNB65. I am trying to fit the data to an ARIMA(1,0,0) model and get the forecasts. I am using R. Here are some output snippets: > arima(x, order = c(1,0,0)) Series: x ARIMA(1,0,0) with non-zero mean Call: arima(x = x, order = c(1, 0, 0)) Coefficients: ar1 intercept 0.9421 12260.298 s.e. 0.0474 202.717 > predict(arima(x, order = c(1,0

Is there an easy way to revert a forecast back into a time series for plotting?

假装没事ソ 提交于 2019-12-19 10:29:26
问题 I am new to R and have found this site extremely helpful, so this covers the second half of my question (one issue per post). Thank you for your assistance ahead of time. Background: I was plotting historical data with multiple forecasts overlaid for visual accuracy checks. This worked great when displayed on an x axis of 'observations'. However, the data is more understandable when plotted with dates on the x axis, so I made it a time series using ts() and it plotted the time series data as