Skip to content

User-friendly errror messages for prob macro #135

Closed
@awellis

Description

@awellis

I tried to obtain the point-wise likelihood for a model containing a predictor variable:

@model AnovaModel(y, group) = begin
    n_groups = length(unique(group))

    σ ~ truncated(Cauchy(0, 3), 0, Inf)
    α ~ filldist(Normal(0, 10), n_groups)
    μ = α[group]
    @. y ~ Normal(μ, σ)
end

chain = sample(AnovaModel(y, group), NUTS(), 2000, save_state = true)

but I forgot to include the predictor on the right-hand side:

logprob"y = y | chain = chain"

instead of

logprob"y = y | group = group, chain = chain"

The following error message is not very helpful: ERROR: AssertionError: all(valid_arg, getargnames(modelgen)).
Maybe the user could be encouraged to add the missing predictors, or could they be conditioned on by default?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions