# Residuals from \`StateSpaceModels.jl\`'s auto\_arima

**URL:** <https://discourse.julialang.org/t/residuals-from-statespacemodels-jl-s-auto-arima/92477>\
**Category:** General Usage\
**Tags:** question, package, time-series\
**Created:** [January 4, 2023, 12:50am UTC](https://discourse.julialang.org/t/residuals-from-statespacemodels-jl-s-auto-arima/92477 "2023-01-04T00:50:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodrigo\_Zepeda](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rodrigo_zepeda/32/17935_2.png) [@Rodrigo\_Zepeda](https://discourse.julialang.org/u/Rodrigo_Zepeda)\
**Post date:** [January 4, 2023, 12:50am UTC](https://discourse.julialang.org/t/residuals-from-statespacemodels-jl-s-auto-arima/92477/1 "2023-01-04T00:50:57Z")

</div>

Hi! I’ve been exploring `StateSpaceModels.jl` for fitting some time series using `auto_arima`. However I’ve run into an issue which might be pretty basic: _Is there a way in which one can get the residuals from the fitted model?_.

I’ve explored the `forecast` function (but only predicts ahead hence no apparent way to get the residuals) and the `fieldnames` of `model` and `model.results` don’t seem to have the residuals anywhere.

Here is the model (which is copy-paste from the documentation)

```julia
using CSV
using DataFrames
using Plots
using StateSpaceModels

airp = CSV.File(StateSpaceModels.AIR_PASSENGERS) |> DataFrame
log_air_passengers = log.(airp.passengers)

model = auto_arima(log_air_passengers; seasonal = 12)
#And the residuals?

```

It seems to me the only way might be by reconstructing from `model.system`’s matrices. I was wondering if there is an easier way (reconstructing from the matrices seems highly inefficient)

---

<div class="post-metadata">

**Author:** ![guilhermebodin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guilhermebodin/32/6982_2.png) [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Post date:** [March 14, 2026, 3:33am UTC](https://discourse.julialang.org/t/residuals-from-statespacemodels-jl-s-auto-arima/92477/2 "2026-03-14T03:33:26Z")

</div>

Sorry for the ultra delayed response.

You can get the innovation residuals with this call

```julia
kf = kalman_filter(model)
v = get_innovations(kf)

```
