Search code examples
rtime-seriesforecasting

Arima fails to estimate a simple AR(1) in R


Simulate an AR(1) in R as follows:

# True parameters
b0 <- 1   # intercept
b1 <- 0.9 # coefficient
trueMean <- b0 / (1-b1) # equals to 10

set.seed(8236)
capT <- 1000
eps <- rnorm(capT)

y <- rep(NA,capT)
y[1] <- b0 + b1*trueMean + eps[1] # Initialize the series
for(t in 2:capT) y[t] = b0 + b1*y[t-1] + eps[t]

reg1 <- ar(y)
reg2 <- arima(y, order=c(1,0,0))
reg3 <- lm( y[2:capT] ~y[1:(capT-1)] )

Both reg1 and reg3 estimates are close to the true values. However, reg2 which uses the arima function estimates an intercept close to the true Mean of 10. Any clue as to why this is happening?


Solution

  • Got the answer on this page http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm It seems arima() reports the mean but calls it intercept!