I am trying to understand what the reported intercept is showing when I use
xreg=. The documentation says
"If am xreg term is included, a linear regression (with a constant term if include.mean is true and there is no differencing) is fitted with an ARMA model for the error term."
Thus I expect the intercept shown to come from the regression using
xreg= as the X variables, before any arima model is done on those residuals.
However I tried to double check this by actually doing the regression with
lm() and the intercept from that does not match what is reported from
arima() (although the slope coefficient is pretty close).
Here is my example:
set.seed(456) v = rnorm(100,1,1) x = cumsum(v) ; x = as.xts(ts(x)) # Fit AR(1) after taking out a time trend (aka, drift) model5 = arima(x, order=c(1,0,0), xreg=1:length(x), include.mean=TRUE) # Coefficients: # ar1 intercept 1:length(x) # 0.8995 0.8815 1.1113 # s.e. 0.0422 1.6193 0.0265 # Double check MyTime = 1:length(x) model5_Part1 = lm(x ~ MyTime ) # Coefficients: # (Intercept) MyTime # 1.856 1.096
The intercepts do not match, thus I do not know what the intercept is showing from the arima with xreg.
Note the example shown is based on "Issue 2" shown here http://www.stat.pitt.edu/stoffer/tsa3/Rissues.htm
Also note that this isn't a problem particular to modeling drift. Here is another example, where in addition to the intercept not matching, even the slope coefficient on the
xreg= variable doesn't match what is shown from using
lm(). This example has nothing to do with drift and uses the cars dataset as if it were time series data.
data(cars) cars = as.xts(ts(cars, start=c(1980,1), freq=12)) model6 = arima(cars$speed, xreg=cars$dist, order=c(1,0,0), include.mean=TRUE) # Coefficients: # ar1 intercept dist # 0.9979 15.2890 -0.0172 # s.e. 0.0030 10.5452 0.0055 model6_Part1 = lm(cars$speed ~ cars$dist) # Coefficients: # (Intercept) cars$dist # 8.2839 0.1656
Intercepts do not match, slope coefficient does not match.