-
Hi everyone, I'm still relatively new to Julia, "MethodError: no method matching MvNormal(::Matrix{Float64}, ::Float64)" Here's the code that I'm running:
The I'm not sure what's causing this error, and I'm not familiar with the Thanks in advance for any help you can provide! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
So, all in all using LinearAlgebra
@model function bayesian_glm(y, G, P, L, A)
# Priors for the coefficients
β0 ~ Normal(0, 10)
β1 ~ filldist(Normal(0, 1), 4)
β2 ~ filldist(Normal(0, 1), 2, 2)
β4 ~ Normal(0, 10)
sigma ~ Exponential(1)
μ = β0 .+ β1[G] .+ β2[L, P] .+ β4 .* A
y ~ MvNormal(μ, sigma * I) # though if `sigma` is the variance, you should do `sigma^2 * I`
end
chain = sample(bayesian_glm(y, G, P, L, A), NUTS(), 1000, 4, progress=false); |
Beta Was this translation helpful? Give feedback.
MvNormal
is provided by Distributions.jl and it was decided to disallowMvNormal(..., ::Real)
because some users expected the 2nd argument (thesigma
) to represent the standard deviation while others expected variance. Instead you can usesigma^2 * I
whereI
, representing a uniform scale matrix, becomes available after doingusing LinearAlgebra
.So, all in all