# Get fitted values estimated in ARIMA in Matlab

I am using Matlab to forecast time series data using ARIMA algorithm. I am able to get forecasted values, but unable to get the fitted values. This is what I mean. In R:

 model <- auto.arima(data)");
forecasted <- forecast.Arima(model, h=36)
forecasted$fitted  forecasted$fitted will give the data which has been fitted to the original data by the ARIMA algorithm. But I cannot see anything like that in Matlab. This is what I have done so far:

model = arima(1,1,0);
[est, ~, logL, info] = estimate(model, data);
[output, YMSE] = forecast(est, 10);


output gives me the 10 values Arima has forecasted, but not the original data values it has fitted. I would like to know those.

Any help is appreciated.

I believe what you want can be indirectly obtained using the function infer.

As in general the actual fitted values from an ARIMA model are of little use themselves, what MATLAB returns is the residuals vector (somewhat oddly). In your case after you have estimated the parameters of the ARIMA model of your choice (model) given your observed univariate time series (data), you can use the model containing the parameter estimates (est) to infer the residuals of your model. So you want something like:

residuals = infer(est,data);


Following that you actual estimated values (est_data) are simply:

est_data = data - residuals;


Take note that infer function uses default setting regarding presample data. I do not know what are R is doing to get its estimates so I would advice you to look at the notion of presample before continuing. You might be surprised about what assumptions are put in place by different packages.