Since priors
is a vector of heterogeneous elements (Normal
and Beta
), it does not have a concrete element type. The quickest fix is probably using tuples, and then I would do the same for pars
. Eg
using Distributions
const priors = (Normal(0, 1), Beta(2, 5))
const pars = (2.0, 0.9)
function prioreval_test(priors, pars)
if all(insupport.(priors, pars))
log_priorval = sum(logpdf.(priors, pars))
alarm = false
else
log_priorval = -Inf
alarm = true
end
return log_priorval, alarm
end
@code_warntype prioreval_test(priors, pars)
That said, I would recommend you use NamedTuple
s for parameters, which can avoid order mixups.