# How to compute estimate for the first time series value using ARIMA model?

I modeled a univariate time series in R using the Arima command. One can obtain fitted values for the original series using this command by applying the function fitted to the model. However, I noticed that the fitted data has the same dimension as the original data. Hence, a fitted value for the first value in the time series was computed even though there is no past data. I checked wheter it is the mean of the series or the intercept of the model but that isn't the solution. What are possible approaches to get a fitted value here?

The code below is a reproducible example using the Lynx data set.

> library(xts)
> library(forecast)
>
> data("lynx")
>
> Y      <- as.xts(log10(lynx))
> model  <- Arima(Y, order= c(1, 0, 0))  #Fit AR(1) model
> fit    <- fitted(model)
> length(fit) == length(Y)
[1] TRUE


There are different methods that are commonly used to calculate or set initial values for time series modeling algorithms.

• The simplest are heuristics, like using the overall mean, or the first observation, or the mean of the first $n$ observations, or whatever. These are often used when there is no underlying statistical model, or when we don't care about it, like in Exponential Smoothing or in Croston's method for intermittent demands.

• Conversely, you can treat not only your AR and MA parameters as parameters, but also the initial values, and then optimize these by maximizing the likelihood, assuming that you do have a statistical model. Conditional sums of squares are similar, though I don't have the details handy.

Sometimes we will use heuristics even if a statistical model is available. For instance, if you have a long seasonal pattern, say weekly data with yearly seasonality, you will have to optimize a lot of parameters, and you likely won't have a lot of data compared to the number of parameters, so you may end up overfitting if you use maximum likelihood. In such case, it makes sense to use heuristics for computational and stability reasons.

Finally, for your specific application, here is what ?Arima tells you for the method parameter:

The default (unless there are missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood.

If you are interested in the gory details, you could look into the source code.