forecasting

Measuring VAR accuracy using accuracy() from forecast

佐手、 提交于 2019-12-19 03:09:14
问题 I'm trying to learn a vector autoregressive model using the vars package in R. This package doesn't have any way to measure the accuracy of the returned model. Specifically, I want to use MASE as defined in the accuracy function from the forecast package in R to compare forecasting with VAR with forecasting using Arima models on each component time series (I'm using 4 possibly correlated time series). accuracy doesn't recognize the varest object returned by vars . How can I get the MASE for

Forecast accuracy: no MASE with two vectors as arguments

荒凉一梦 提交于 2019-12-19 02:46:16
问题 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

Using Prophet Package to Predict By Group in Dataframe in R

时光毁灭记忆、已成空白 提交于 2019-12-17 22:37:46
问题 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

Forecasting basis the historical figures

与世无争的帅哥 提交于 2019-12-14 00:01:50
问题 I want to forecast the allocations basis the historical figures. Manual Input provided by the user: year month x y z k 2018 JAN 9,267,581 627,129 254,110 14,980 2018 FEB 7,771,691 738,041 217,027 17,363 Output from Historical figures: year month segment pg is_p x y z k 2018 JAN A p Y 600 600 600 600 2018 JAN A p N 200 200 200 200 2018 JAN B r Y 400 400 400 400 2018 JAN A r Y 400 400 400 400 2018 JAN A r N 400 400 400 400 2018 JAN B r N 300 300 300 300 2018 JAN C s Y 200 200 200 200 2018 JAN C

Forecat : incorrect number of dimensions in R [closed]

青春壹個敷衍的年華 提交于 2019-12-13 04:32:53
问题 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 last year . I conduct TS analysis. My dput(). df=structure(list(month = structure(c(5L, 4L, 8L, 1L, 9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 6L, 2L, 12L,

Difference between mean and fitted in forecast function

非 Y 不嫁゛ 提交于 2019-12-13 02:34:52
问题 I'm new to forecasting and I'm trying to use the forecast package in r. Can someone please explain the difference between mean and fitted in the forecast function? For example, fcast<-forecast(ts,h=30) fcast$mean fcast$fitted The documentation says "mean is Point forecasts as a time series" and "fitted is Fitted values (one-step forecasts)". An example to illustrate the difference would be great. Any help much appreciated. 回答1: fcast$fitted is the result of the fit (the model fitted to

need to fill the NA values with the past three values before na values in python

让人想犯罪 __ 提交于 2019-12-13 02:14:22
问题 need to fill the NA values with the past three values mean of that NA this is my dataset RECEIPT_MONTH_YEAR NET_SALES 0 2014-01-01 818817.20 1 2014-02-01 362377.20 2 2014-03-01 374644.60 3 2014-04-01 NA 4 2014-05-01 NA 5 2014-06-01 NA 6 2014-07-01 NA 7 2014-08-01 46382.50 8 2014-09-01 55933.70 9 2014-10-01 292303.40 10 2014-10-01 382928.60 回答1: is this dataset a .csv file or a dataframe. This NA is a 'NaN' or a string ? import pandas as pd import numpy as np df=pd.read_csv('your dataset',sep=

How to get Stata to produce a dynamic forecast when using lagged outcome as a regressor?

落花浮王杯 提交于 2019-12-13 00:43:08
问题 I am currently dealing witha very small data set (20 observations, I know it's terrible). But I need to somehow forecast out the values. When I simply regress time on the dependent variable I am able to get a prediction, but when I add lagged or differenced variables it does not predict more than one year into the future. Is this due to having too few observations? Here is my code for context. The two lines have have commented out result in a better fitting prediction for present data, but

Undo a Series Diff

a 夏天 提交于 2019-12-12 15:23:01
问题 I have a pandas Series with monthly data ( df.sales ). I needed to subtract the data 12 months earlier to fit a time series, so I ran this command: sales_new = df.sales.diff(periods=12) I then fit an ARMA model, and predicted the future: model = ARMA(sales_new, order=(2,0)).fit() model.predict('2015-01-01', '2017-01-01') Because I had diffed the sales data, when I use the model to predict, it predicts forward diffs. If this was diff of period 1, I would just use an np.cumsum() , but because

Use Hourly data in ts and window function

早过忘川 提交于 2019-12-12 12:31:49
问题 I have hourly data like the sample below that I am trying to create a time-series from and use the window function with. My end goal is to use this to train an Arima model. I'm having a hard time getting ts() or window() to work with my date time format. I've also tried using msts() but couldn't get it to work with the date time format. I have gotten xts() to work, but it doesn't seem to work correctly with the window() or Arima() . Is it possible to use this date time format with ts() and