在 R 中获得最佳 ARIMA 模型的快速解决方案(函数`auto.arima`) [英] A fast solution to obtain the best ARIMA model in R (function `auto.arima`)

查看:67
本文介绍了在 R 中获得最佳 ARIMA 模型的快速解决方案(函数`auto.arima`)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由 2775 个元素组成的数据系列:

I have a data series composed by 2775 elements:

mean(series)
[1] 21.24862
length(series)
[1] 2775
max(series)
[1] 81.22
min(series)
[1] 9.192

我想通过使用forecast包的函数auto.arima来获得最好的ARIMA模型:

I would like to obtain the best ARIMA model by using function auto.arima of package forecast:

library(forecast)
fit=auto.arima(Netherlands,stepwise=F,approximation = F)

但是我遇到了一个大问题:RStudio 运行了一个半小时没有结果.(我开发了一个 R 代码来执行这些计算,在配备 2.80GHz Intel(R) Core(TM) i7 CPU 和 16.0 GB RAM 的 Windows 机器上使用.)我怀疑这是由于时间序列的长度.解决方案可能是并行化?(但我不知道如何应用它).

But I am having a big problem: RStudio is running for an hour and a half without results. (I developed an R code to perform these calculations, employed on a Windows machine equipped with a 2.80GHz Intel(R) Core(TM) i7 CPU and 16.0 GB RAM.) I suspect that this is due to the length of time series. A solution could be the parallelization? (But I don't know how apply it).

无论如何,有什么建议可以加速这段代码?谢谢!

Anyway, suggestions to speed this code? Thanks!

推荐答案

预测包的许多功能都考虑到了并行处理.auto.arima() 功能是并行的".

The forecast package has many of its functions built with parallel processing in mind. One of the arguments of the auto.arima() function is 'parallel'.

根据包文档,如果 [parallel = ] TRUE 和 stepwise = FALSE,则规范搜索是并行完成的.这可以显着提高多核机器的速度."

According to the package documentation, "If [parallel = ] TRUE and stepwise = FALSE, then the specification search is done in parallel.This can give a significant speedup on mutlicore machines."

如果parallel = TRUE,它会自动选择使用多少个核心"(对于笔记本电脑或台式机,通常是核心数* 2.例如,我有4个核心,每个核心有2个处理器=8 个核心").如果您想手动设置核心数,也可以使用参数 num.cores.

If parallel = TRUE, it will automatically select how many 'cores' to use (for a laptop or desktop, it is often the number of cores * 2. For example, I have 4 cores and each core has 2 processors = 8 'cores'). If you want to manually set the number of cores, also use the argument num.cores.

我建议您查看 Hyndman 撰写的有关该软件包的所有电子书.它就像一本时间序列预测圣经.

I'd recommend checking out the e-book written by Hyndman all about the package. It is like a time-series forecasting bible.

这篇关于在 R 中获得最佳 ARIMA 模型的快速解决方案(函数`auto.arima`)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆