[Rd] Fix for bug in arima function

Patrick Perry pperry at stern.nyu.edu
Mon Apr 20 18:34:26 CEST 2015

There is currently a bug in the arima function. Namely, for arima models with differencing or seasonal differencing, the innovation variance estimator uses the wrong denominator whenever xreg is non-null. This is the case, for example, when fitting an ARIMA(p,1,q) model with a drift term (common in financial applications). I reported the bug (and a fix) at https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16278 , but my report may have fallen through the cracks due to the timing around the 3.2.0 release.

The bug was introduced in the patch displayed here:


The fix is very simple:


I’ve posted a script that demonstrates the bug at


Please let me know if there’s anything I can do to help get this fix incorporated.

Patrick Perry
Assistant Professor
Stern School of Business
New York University

More information about the R-devel mailing list