Hello everyone, I have just started to learn Julia, and Julia is the only language with which I’ve worked for more than 3 months, so **I am new to programming in general**.

**I need to make 46 future quarterly estimates of interest rate data**. After having estimated the coefficients of an autoregressive AR(5), I found its companion matrix to get

Xt+1 = Companion(Φ(5)) * Xt

in order to compute the future 46 Xt+1.

I tried to do some research on how to **come up with a loop that saves my next 40 estimates in an array**, but I’m not sure how to do this. Other topics do not seem related to the collection of iterations, hence, I hope you can help me and that this is not too silly, thank you for your attention.

What I have tried to do up to now is:

```
maxiter = 46
oldΔp = pastΔp[:, 1] #past interest rates, column 1 for country 1
iter = 1
while iter <= maxiter
futΔp = βcomp_US * oldΔp #Companion(Φ(5)) * Xt
#replace and continue
oldΔp = futΔp
iter = iter + 1
end
#=if I do return(futΔp) I only get a 5x1 matrix with only one
new observation at the top
I don't know how to index each result, or just save the
new observations for each iteration in a new array =#
```

Alternatively, following Sargent QuantEcon example, to create a function for fixed points

```
iv = pastΔp[:, 1] #past interest rates, column 1 for country 1
maxiter = 46
function futurevalues(f::typeof(f); iv::Vector{Float64}, maxiter::Int64)
#setup the algorithm, literally identical to Sargent's one
x_old = iv
iter = 1
while iter <= maxiter
x_new = f(x_old)
x_old = x_new
iter = iter + 1
end
return (x_old, iter)
end
f(v) = βcomp_US * v #Companion(Φ(5)) * Xt
v_initial = pastΔp[:, 1] #past interest rates, column 1 for country 1
maxiter = 46
println(futurevalues(f, v_initial, maxiter)) #probably nonsense
```