I want to make a function that transforms some information given what kind of Distributions
type a variable has. Something like:
tdist = typeof(prob.dist)
if tdist == Distributions.Gamma{Float64}
par_transform[i] = exp(par)
elseif tdist == Distributions.Beta{Float64}
par_transform[i] = logistic(par)
end
where prob.par
is a float, and prob.dist
is a Distributions type. The above works, but clearly is not type stable as tdist
changes as I loop over an array of different distributions types. Is there a proper idiom for doing this kind of transformation? Or is this way the natural way?