I am trying to use the forecast function (forecast package in R) and running into problem. Consider the following example:
library(forecast)
fit=arima(WWWusage,order=c(1,1,1))
fcast=forecast(fit)
plot(fcast)
At the forecast step, I am getting the error message:
Error in .forecast.transform(x, xv, a, h, 1) :
argument "xv" is missing, with no default
This happens even if I replace arima by Arima or auto.arima functions in the forecast package.
Thank you Andrie and Rob for your helpful suggestions. I have fixed the problem, but not sure how. I installed an update to RStudio and reinstalled the forecast library and it worked! Maybe something got messed up recently.
Also, I want to take this opportunity to thank you, Rob, for developing this extremely useful R package.
Related
This question already has an answer here:
'forecast.Arima' function missing from'forecast' package
(1 answer)
Closed 5 years ago.
My code is:
install.packages("forecast")
library(forecast)
fit<-auto.arima(pricetimeseries)
summary(fit)
pricetimeseriesarima<-arima(pricetimeseries, order=c(0,1,1))
forecast.Arima(pricetimeseriesarima), h=5, level=c(99.5))
then
Error in forecast.Arima(pricetimeseriesarima, h = 5, level = c(99.5)) :
could not find function "forecast.Arima"
I install the package correctly, and library it, except forecast.Arima cannot work, there are also other forecast.function cannot use, like forecast.lm, forecast.HoltWinters, etc.
So, what's the problem here, how can I solve it, if anybody can help me, that would be great, Thanks!
No point in using forecast.x(), just use forecast() as stated by Rob Hyndman in the URL from the comments (here). In addition, and as a general rule, you should perhaps use forecast::Arima() rather than stats::arima() as stated in Hyndman and Athanasopoulos (2014):
There is another function arima() in R which also fits an ARIMA model. However, it does not allow for the constant c unless d=0, and it does not return everything required for the forecast() function. Finally, it does not allow the estimated model to be applied to new data (which is useful for checking forecast accuracy). Consequently, it is recommended that you use Arima() instead.
Consequently:
set.seed(100)
pricetimeseries <- rnorm(100)
pricetimeseriesarima <- Arima(pricetimeseries, order=c(0,1,1))
forecast(pricetimeseriesarima, h=5, level=c(99.5))
Hyndman, Rob J., and George Athanasopoulos. Forecasting: principles and practice. OTexts, 2014.
I'm trying out Naive Bayes classification using stock dataset in R. Now for displaying the final results I've seen a function mmetric taking testing data and prediction model as arguments. But while I'm trying the same I'm facing the error could not find function "mmetric". I have installed the rminer and list packages which are quotes as reference packages for these. But still I could not resolve it.
Any Suggestions to resolve the error?
I got same error but i updated my Rcpp package that will be needed by rminer to load on the system, hope this helps.
I am working with the R package 'zoib' for performing beta regression in R. I am trying to replicate the example included on page 41 in the paper the package authors published in The R Journal:
Lui F and Kong Y. 2015. zoib: An R Package for Bayesian Inference for Beta Regression and Zero/One Inflated Beta Regression. The R Journal 7(2)
I believe I am using the exact same data and code that they use:
library(zoib)
data("GasolineYield", package="zoib")
GasolineYield$batch <- as.factor(GasolineYield$batch)
d <- GasolineYield
eg1.fixed <- zoib(yield ~ temp + as.factor(batch) | 1, data=GasolineYield, joint=FALSE,
random=0, EUID=1:nrow(d), zero.inflation=F, one.inflation=F,
n.iter=1050, n.thin=5, n.burn=50)
sample1 <- eg1$coeff
traceplot(sample1)
autocorr.plot(sample1)
gelman.diag(sample1)
However, I am getting an error when I try to do the diagnostic plots on the samples. This is the error message:
Error in ts(seq(from = start(x), to = end(x), by = thin(x)), start = start(x), :
invalid time series parameters specified
I cannot understand why the code isn't working or what I can do to fix the problem. I can trace the error to the time function which is called by zoib, and it seems like maybe it is a problem that the sample object does not have a tsp attribute, but the zoib package authors make it clear that their model output is meant to be used with coda, so I am very confused. I don't have much experience working with MCMC or time series objects, so maybe I am just missing something obvious. Can anyone explain why the example provided by the package authors is failing, and what the solution is?
I e-mailed the package author (Fang Liu) and she informed me that there was in fact a bug in the version of the package I have, but that the bug is fixed in the most recent version of zoib (Version 1.4.2). Using the most recent version, the code now works.
This seems like more of a StackOverflow question than a CrossValidated question so let's see if I'm right...
I'm tinkering around with Revolution R Open (RRO) since I'd like to take advantage of the faster MKL math libraries.
I took some code that works just fine in regular R, tried it in RRO, and got the following error when I attempted to use the tbats() function from the forecast package.
> ts(data, seasonal.periods=c(7,365.25))
> fit<-tbats(myts)
Error in checkForRemoteErrors(val) :
3 nodes produced errors; first error: could not find function "fitSpecificBATS"
If I need to provide some reproducible code/data, I can. However, it appears to me to be more of an issue with the parallelization of the tbats function itself since using the ets function within the same package works just fine.
After a quick search, Error: could not find function “rxGetOption” in Revolution R Open looked promising but seems to be more about RRE vs RRO functions.
Any clue as to what is going on and what I might be able to do for a solution?
Pls can someone help me with how to get auto.arima working in my r. what package should i download? I tried to download auto.arima package but it was not available.
try this
install.packages("forecast")
library(forecast)
then try using the auto.arima function