-
Notifications
You must be signed in to change notification settings - Fork 230
Closed
Labels
Description
I asked on Slack how to do an index variable and @trappmartin responded with the example below. I'd like to contribute some documentation to make this more discoverable. Would the Advanced Usage page be a good place for this?
Do you want something like this: ??
x = vcat(randn(10), randn(10).+10);
g = vcat(ones(Int, 10), ones(Int, 10)*2);
@model function demo(x, g)
a ~ filldist(Normal(), length(unique(g)))
mu = a[g]
x .~ Normal.(mu)
end
model = demo(x,g);
sample(model, NUTS(0.8), 1_000)Summary Statistics
parameters mean std naive_se mcse ess r_hat
────────── ─────── ────── ──────── ────── ──────── ──────
a[1] -0.1021 0.3023 0.0135 0.0105 412.2785 0.9981
a[2] 9.0334 0.3008 0.0135 0.0267 357.4357 0.9985