# StateSpaceModels.Forecast output are not callable/iterable

**URL:** <https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314>\
**Category:** General Usage\
**Tags:** statistics, state-space\
**Created:** [September 27, 2023, 1:24pm UTC](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314 "2023-09-27T13:24:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultratrader](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ultratrader/32/42836_2.png) [@ultratrader](https://discourse.julialang.org/u/ultratrader)\
**Post date:** [September 27, 2023, 1:24pm UTC](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314/1 "2023-09-27T13:24:31Z")

</div>

Hi all,  
I tried to extract the output of the forecast function in StateSpaceModels.jl after fitting using auto\_arima() and convert it to an array for further computation. I am using Julia 1.9.2 and StateSpaceModels.jl v.0.6.7. This is the simplified version of my problems using a sample dataset as well as their related error

```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)

k = forecast(model, 10)
h = collect(values(k)) #no method matching length StateSpaceModels.Forecast{Float64}
h = values(k[1]) #no method matching getindex StateSpaceModels.Forecast{Float64}
k[1] ##no method matching getindex
h = [[i] for i in k] ##no method matching length
typeof(k) #StateSpaceModels.Forecast{Float64}
typeof(k) #StateSpaceModels.Forecast{Float64}
a = Array(k) # no method matching Array()
b = collect(k) #no method matching length

```

Really appreciate your help.

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [September 27, 2023, 4:30pm UTC](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314/2 "2023-09-27T16:30:00Z")

</div>

Try `forecast_expected_value(k)`

---

<div class="post-metadata">

**Author:** ![ultratrader](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ultratrader/32/42836_2.png) [@ultratrader](https://discourse.julialang.org/u/ultratrader)\
**Post date:** [September 28, 2023, 2:00am UTC](https://discourse.julialang.org/t/statespacemodels-forecast-output-are-not-callable-iterable/104314/3 "2023-09-28T02:00:27Z")

</div>

thank you, it works!
