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

查看:64
本文介绍了快速获得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.80GHzIntel®Core™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!

推荐答案

Forecast程序包的许多功能都是在考虑并行处理的基础上构建的. 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,则说明搜索是并行进行的.这可以大大提高mutlicore机器的速度."

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天全站免登陆