Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does knitr show a warning using auto.arima?

It appears that running auto.arima from the forecast package in a knitr script always generates a warning - and I don't get this warning when I run it in normal R.

knitr Markdown Example Code:

```{r}
library(forecast)
```
Spurious warning from forecast and knitr
========================================

The following generates a warning that I don't think is valid

```{r}
summary(auto.arima(WWWusage))
```

Produces this:

knitroutput

Whereas running the following in R normally produces no such warning:

> library(forecast)
This is forecast 4.02 

> summary(auto.arima(WWWusage))
Series: WWWusage 
ARIMA(1,1,1)                    

Coefficients:
         ar1     ma1
      0.6504  0.5256
s.e.  0.0842  0.0896

sigma^2 estimated as 9.793:  log likelihood=-254.15
AIC=514.3   AICc=514.55   BIC=522.08

Training set error measures:
       ME      RMSE       MAE       MPE      MAPE      MASE 
0.3035616 3.1137542 2.4052748 0.2805566 1.9174634 0.5315228 

Also since this dataset is the example dataset for auto.arima I'm inclined to believe that the warning is incorrect (since I suspect a "good" example would be given).

Any idea what is going on?

like image 842
Corvus Avatar asked Mar 12 '13 12:03

Corvus


1 Answers

That warning did exist, but was suppressed internally by forecast; see options(warn = -1) in forecast:::search.arima.

knitr (actually the evaluate package) captures the warnings regardless of the getOption('warn') value. In this case, you have to use the warning=FALSE option as Jilber suggested.

like image 141
Yihui Xie Avatar answered Nov 03 '22 22:11

Yihui Xie