-
I have a problem where I draw a vector of random numbers. # Priors
beta_mean ~ uniform(0.0, 1.0)
beta_sd ~ uniform(0.0, 0.1)
for i in 1:nsteps
{(:βi,i)} ~ normal(beta_mean, beta_sd)
end I want to pass this series of addresses as a vector to another function in order to get a derived variable within the same |
Beta Was this translation helpful? Give feedback.
Answered by
ztangent
Jul 4, 2025
Replies: 1 comment 1 reply
-
You can do assignment in addition to sampling. The For your example, you can do: # Priors
beta_mean ~ uniform(0.0, 1.0)
beta_sd ~ uniform(0.0, 0.1)
beta = zeros(nsteps)
for i in 1:nsteps
beta[i] = {(:βi,i)} ~ normal(beta_mean, beta_sd)
end |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sdwfrost
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do assignment in addition to sampling. The
~
syntax in a@gen
function is just syntactic sugar (as explained here: https://www.gen.dev/docs/dev/ref/modeling/dml/#Tilde-syntax)For your example, you can do: