forecasting

Export accuracy of multiple timeseries forecasts in r into csv-document

[亡魂溺海] 提交于 2019-12-25 08:20:00
问题 I am using the fpp package to forecast multiple time series of different customers at the same time. I am already able to extract the point forecasts of different easy forecast methods ( snaive , meanf , etc.) into a csv document. However, I am still trying to figure out how to extract the measures of the accuracy() command of every time series into a csv file at the same time. I constructed an example: # loading of the "fpp"-package into R install.packages("fpp") require("fpp") # Example

Error in arima of R: too few non-missing observations

本秂侑毒 提交于 2019-12-24 15:26:20
问题 I am using arima() and auto.arima() of R to get the prediction of sales. The data is at week level for three years. my code looks like: x<-c(1571,1501,895,1335,2306,930,2850,1380,975,1080,990,765,615,585,838,555,1449,615,705,465,165,630,330,825,555,720,615,360,765,1080,825,525,885,507,884,1230,342,615,1161, 1585,723,390,690,993,1025,1515,903,990,1510,1638,1461.67,1082,1075,2315,1014,2140,1572,794,1363,1184,1248,1344,1056,816,720,896,608,624,560,512,304,640,640,704,1072,768, 816,640,272,1168

how to predict using var with exogenous variables in R

北城以北 提交于 2019-12-24 12:18:05
问题 I have the following data: library(data.table) modelling_dt_train <- structure(list(`1` = c(54593L, 74481L, 85566L, 97637L, 101081L, 184089L, 158895L, 153780L, 153681L, 157188L, 142216L, 136437L, 135501L, 111264L, 123259L, 110397L, 146034L, 162900L, 132499L, 121516L, 119651L, 114045L, 112551L, 123209L, 134930L, 132147L, 151327L, 155666L, 158538L, 205766L, 200407L, 219588L, 231954L, 179884L, 159121L, 156148L, 136191L, 132956L, 202086L, 141047L, 118490L, 116595L, 127620L, 135962L, 137419L,

Error when forecasting with midasr (reproducible example included)

ε祈祈猫儿з 提交于 2019-12-24 09:57:48
问题 The code is self contained, except the datasets which is linked below. .csv files used in the code, download this first please: https://drive.google.com/?authuser=0#folders/0B1ciW4R5hjUCRFpjQlJKZGFqcVU library(midasr) library(zoo) yvellaregdata <- read.table("~/Desktop/attempt1/ymonthlyjackson.csv", quote="\"") yvellareg <- ts(yvellaregdata, start=c(2008,7), frequency=12) xvellareginit <- read.table("~/Desktop/attempt1/xdailyjackson.csv", quote="\"") xvellaregzoo <- zoo(xvellareg) xvellareg <

Error in ts(x) : 'ts' object must have one or more observations

被刻印的时光 ゝ 提交于 2019-12-24 01:53:40
问题 When I do forecast using forecast library, I noticed following code does not run as expected: library(forecast) library(dplyr) df1 <- data.frame(gp=gl(20,5), dt=seq(1:100)) get <- function (df1){ ts1 <- ts((df1%>%filter(gp==2))$dt) as.numeric(forecast(ar(ts1),15)$mean) } print(get(df1)) The error return is: Error in ts(x) : 'ts' object must have one or more observations May be it is caused by ar or ar.burg function. Because if you change the function to ets or something else the function

Forecast package Prediction Horizon issue in R

你说的曾经没有我的故事 提交于 2019-12-24 01:13:03
问题 I am new to R. I was trying to predict using holt method but getting this strange error. I am using forecast package V-7.1 with R (version 3.2.5) and Rstudio (Version 0.99.896). I reinstall all from R to Rstudio but did not work. Only h from 1 to 10 works. Any idea?? library(forecast) library(stats) library(base) x=data$cost k<-holt(x,damped=TRUE) m=forecast(k,h=20) Error in forecast.forecast(k, h = 20) : Please select a longer horizon when the forecasts are first computed Other testing cases

How to change maxlag for ARMAX.predict?

对着背影说爱祢 提交于 2019-12-22 09:49:16
问题 Still in the process of understanding the ARIMA source code to forecast some data. (I use two time series (indexed_df and external_df with 365 data points each.) I want to compare the forecast accuracy between ARMA and ARMAX. The forecasting process for ARMA seems to work fine. But forecasting with one additional external variable does not work somehow: Getting p and q values for ARMAX: arma_mod1 = sm.tsa.ARMA(indexed_df, (2,0), external_df).fit() y = arma_mod1.params print 'P- and Q-Values

Plotting `forecast` prediction using `dygraphs`

本小妞迷上赌 提交于 2019-12-22 08:44:16
问题 I want to plot a forecast package time series model's predictions using dygraphs . The documentation suggests the following approach for predictions with actuals: hw <- HoltWinters(ldeaths) p <- predict(hw, n.ahead = 36, prediction.interval = TRUE) all <- cbind(ldeaths, p) dygraph(all, "Deaths from Lung Disease (UK)") %>% dySeries("ldeaths", label = "Actual") %>% dySeries(c("p.lwr", "p.fit", "p.upr"), label = "Predicted") Resulting in: The interesting thing about the plotted object all is its

Installing R `forecast` package on a Linux Cluster: compiler issues?

南楼画角 提交于 2019-12-22 05:53:11
问题 I am looking to test performance of R , more specifically some routines in the forecast package on an HPC cluster with Intel Xeon Phi co-processors. The sysadmin has, I understand, built R/3.2.5 from source following the instructions on Intel's website: https://software.intel.com/en-us/articles/build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux So R works, installation of packages including devtools , data.table , dplyr , ggplot2 , Rcpp , RcppArmadillo can be carried out from within an

Installing R `forecast` package on a Linux Cluster: compiler issues?

天涯浪子 提交于 2019-12-22 05:53:08
问题 I am looking to test performance of R , more specifically some routines in the forecast package on an HPC cluster with Intel Xeon Phi co-processors. The sysadmin has, I understand, built R/3.2.5 from source following the instructions on Intel's website: https://software.intel.com/en-us/articles/build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux So R works, installation of packages including devtools , data.table , dplyr , ggplot2 , Rcpp , RcppArmadillo can be carried out from within an