Multivariate State Space model using Turing #2094
Unanswered
KotaAihara
asked this question in
Q&A
Replies: 1 comment 9 replies
-
But to make this work, you can try: @model function SSM_2D(y, ::Type{TV}=Matrix{Float64}) where {TV}
T = size(y, 1)
k = size(y, 2)
#prior
Σ_x ~ InverseWishart(2, [1.0 0.0; 0.0 1.0])
Σ_y ~ InverseWishart(2, [1.0 0.0; 0.0 1.0])
B = zeros(k, k )
for i in 1:k
for j in 1:k
B[i,j] ~ Normal(0, 1)
end
end
x = TV(undef, T, k)
for t in 2:T
μ_x = B * x[t-1, :]
x[t, :] ~ MvNormal(μ_x, Σ_x)
x_t = x[t, :]
y[t, :] ~ MvNormal(x_t, Σ_y)
end
end |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m making 2d state space model by using Turing.jl
Here is my code. x[t] is state equation and y[t] is observation equation.
but I got this error.
I suppose it happened in for loop. Could you teach me how to fix my error?
Beta Was this translation helpful? Give feedback.
All reactions