-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with hierarchical model with LKJCholesky sampling! #1807
Comments
|
I see. Thanks @devmotion for the input. I did however try just |
I am also experiencing this same error: # define the model
@model function correlated_varying_intercept_slope_regression(X, idx, y;
predictors=size(X, 2),
N=size(X, 1),
n_gr=length(unique(idx)))
# priors
# Turing does not have LKJCholesky yet
# see: https://github.com/TuringLang/Turing.jl/issues/1629
#Ω ~ LKJCholesky(predictors, 2.0)
Ω ~ LKJ(predictors, 2.0)
σ ~ Exponential(1)
# prior for variance of random intercepts and slopes
# usually requires thoughtful specification
τ ~ filldist(truncated(Cauchy(0, 2), 0, Inf), predictors) # group-level SDs
γ ~ filldist(Normal(0, 5), predictors, n_gr) # matrix of group coefficients
Z ~ filldist(Normal(0, 1), predictors, n_gr) # matrix of non-centered group coefficients
# reconstruct β from Ω and τ
#β = γ + τ .* Ω.L * Z # Turing does not have LKJCholesky yet
β = γ + Diagonal(τ) * Ω * Diagonal(τ) * Z
# likelihood
for i in 1:N
y[i] ~ Normal(X[i, :] ⋅ β[:, idx[i]], σ)
end
return(; y, β, σ, Ω, τ, γ, Z)
end |
@storopoli yeah and using
|
So @sethaxen helped me make a fix for this issue. Here is his suggested updated code
I really appreciate @sethaxen help with this and I will close this issue since it was resolved for me as well as @storopoli. However, I still think the |
any updates on whether it is supported, and are there any example use cases? |
Hi,
I have attached below a model I am trying to adapt from a similar Stan implementation. Briefly, the model is a compartmental model for a drug that is described using an ODEProblem
prob
. I am trying to run a Bayesian inference on the model parameters that include fixed effects and random effects. The latter include random effects to characterize interindividual variability (IIV) between patients. Often these IIV params would be correlated so it is important to estimate the correlation as well. To characterize correlation I want to use LKJ cholesky however when I try to fit I get this error.I only put a snapshot of the beginning of the error but please let me know if more details are needed.
Any ideas how I can fix this model?!
Thanks.
The text was updated successfully, but these errors were encountered: