Recall that auto.arima()
fits a regression with ARIMA errors.
The key issue is the treatment of the intercept. lm()
will always fit an intercept, but auto.arima(..., allowmean=TRUE)
may do so (or remove it - there apparently is no way to force auto.arima()
to include the intercept, unless you run lm()
first, then call auto.arima()
on the residuals).
Some playing around will give you different possible combinations (I'm truncating the output):
> set.seed(1)
> foo <- ts(rnorm(100))
> bar <- rnorm(100)
> summary(lm(foo~bar))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.1088521 0.0903480 1.205 0.231
bar -0.0009324 0.0947216 -0.010 0.992
> summary(auto.arima(foo,xreg=bar))
Regression with ARIMA(0,0,0) errors
Coefficients:
xreg
-0.0055
s.e. 0.0944
This is your situation: lm ()
fits an intercept, auto.arima()
doesn't, so the coefficients (and the standard errors, and p values) don't match. You can force these to match by excluding the intercept from the lm()
model:
> summary(lm(foo~bar-1))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
bar -0.005456 0.094863 -0.058 0.954
Adding an offset induces auto.arima()
to include the intercept:
> summary(lm(foo+1~bar))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.1088521 0.0903480 12.27 <2e-16 ***
bar -0.0009324 0.0947216 -0.01 0.992
> summary(auto.arima(foo+1,xreg=bar))
Regression with ARIMA(0,0,0) errors
Coefficients:
intercept xreg
1.1089 -0.0009
s.e. 0.0894 0.0938
And the coefficients and (mostly) the standard errors match again.