forecasting

How to use Arima for data with 2 indexes

岁酱吖の 提交于 2019-12-11 16:54:44
问题 I have a time series problem that is a little modified. I have 2 indexed variables, date and user id. for each user id, date, i want to forecast a value. The interesting part is the date resets for each new user id. Standard time series problem have for this time period, forecast the next n days. In my train data, i have for each user id, for jan 1-3, i have their target value. In my test data, for each user id, test date is jan 4-6. For both the train and test data, index of the dataframe is

STL function minimum observation

北城以北 提交于 2019-12-11 15:57:14
问题 I am building a forecasting model sing R utilizing stl() function. I have monthly data for 2 years, that's 24 observations, 2 period. Now stl() won't allow me to decompose my data saying that I have less than the required minimum observation. I check the code and yes, it needs to be 24 + 1 or 2 period + 1. My question is why it needs extra observation? decompose() function needs only at least 2 period. 来源: https://stackoverflow.com/questions/48723342/stl-function-minimum-observation

Forecasting using Multiple Regression in BigQuery

假如想象 提交于 2019-12-11 15:56:45
问题 Pity Google BigQuery still doesn't have a function such as forecast() that we see in Spreadsheets-- don't look down on yet; given one has the statistical know-how, surprising amount of smoothing and seasonality can be added to forecasting on spreadsheets. BigQuery allows you to determine Standard Deviation, correlation and intercept metrics. Using that, one can create the prediction model-- refer to this and this. But that uses Linear regression model; so we are not happy with the seasonality

Forecasting with ets results

这一生的挚爱 提交于 2019-12-11 13:34:59
问题 I load a dataframe (named stock) with this data: day value 2000-12-01 00:00:00 11.809242 2000-12-01 06:00:00 10.919792 2000-12-01 12:00:00 13.265208 2000-12-01 18:00:00 13.005139 2000-12-02 00:00:00 10.592222 2000-12-02 06:00:00 8.873160 2000-12-02 12:00:00 12.292847 2000-12-02 18:00:00 12.609722 2000-12-03 00:00:00 11.378299 2000-12-03 06:00:00 10.510972 2000-12-03 12:00:00 8.297222 2000-12-03 18:00:00 8.110486 2000-12-04 00:00:00 8.066154 I try to implement forecasting using ets() model

Fitted values in R forecast missing date / time component

久未见 提交于 2019-12-11 11:36:29
问题 I've been doing a variety of models in R with time series data (in XTS format) and I keep running into the same issue where there's no date / time component to the fitted values / forecasts and thus I can't graph them on the same graph as the original data. Using the following code, from everything I see online I SHOULD get two line graphs on the same graph. However, I just get the original graph from the plot command and the second line never appears. library("stats") library("forecast")

ARMAX model forecasting leads to “ValueError: matrices are not aligned” when passing exog values

自作多情 提交于 2019-12-11 09:18:17
问题 I'm struggling with forecasting out of sample values with an ARMAX model. Fitting the model works fine. armax_mod31 = sm.tsa.ARMA(endog = sales, order = (3,1), exog = media).fit() armax_mod31.fittedvalues Forecasting without exogenous values, as far as I have an according model, works fine as well. arma_mod31 = sm.tsa.ARMA(sales, (3,1)).fit() all_arma = arma_mod31.forecast(steps = 14, alpha = 0.05) forecast_arma = Series(res_arma[0], index = pd.date_range(start = "2013-08-21", periods = 14))

How to get the actual date plotted in X axis while plotting the auto.arima forecase in R?

ε祈祈猫儿з 提交于 2019-12-11 05:14:08
问题 I have a gold price data set with "DATE" and "GOLD PRICE" variables.After doing all the pre processing steps in R,I convert the data frame object to time series by ts or xts function and check for stationary through adf test. Now by enabling forecast library I run auto.arima function and forecast next ten values. x <- "DATE" "GOLD PRICE" 01-01-2006 1326 x.xts <- xts(x$GOLD PRICE,X$DATE), fit <- auto.arima(x.xts) forecast <- forecast(fit,h=10) Now when I plot the forecast I get some values

Azure ML Batch Run - Single Output

丶灬走出姿态 提交于 2019-12-11 04:04:12
问题 I create an forecasting experiment using R engine. My data source is pivoted, hence I need to pass row by row. The output works great with single row prediction. But when I try to populate multiple lines, it still gives single row output - for the first record only. I'm trying to loop my result as follows : # Map 1-based optional input ports to variables dataset1 <- maml.mapInputPort(1) # class: data.frame library(forecast) library(reshape) library(dplyr) library(zoo) #exclude non required

how to use forecast function for simple moving average model in r?

六眼飞鱼酱① 提交于 2019-12-11 03:09:39
问题 I want to predict the future values for my simple moving average model. I used the following procedure: x <- c(14,10,11,7,10,9,11,19,7,10,21,9,8,16,21,14,6,7) df <- data.frame(x) dftimeseries <- ts(df) library(TTR) smadf <- SMA(dftimeseries, 4) # lag is 4 library(forecast) forecasteddf <- forecast(smadf, 4) # future 4 values When run the above code, my forecast values are the same for all the next 4 days. Am I coding it correctly? Or, am I conceptually wrong? The same is the case with

Forecasting error in R when passing around arguments in forecast() and ar()

会有一股神秘感。 提交于 2019-12-10 14:57:25
问题 When trying to compose a function from smaller ones using Rob Hyndman's forecast library, like so: > library('forecast') > arf <- function(data, ...) forecast(ar(data, order.max=1, method="ols"), ...) I get an error when trying to plug in some data: > arf(ts(1:100, start=c(2000,1), frequency=4)) Error in ts(x, frequency = 1, start = 1) : object is not a matrix However, using the body of arf directly works perfectly: > forecast(ar(ts(1:100, start=c(2000,1), frequency=4), order.max=1,method=