I am trying to set up a log-posterior for MCMC sampling using DynamicHMC.jl
. I have two unconstrained parameters, and then a vector of parameters that must be negative. Using TransformVariables.jl
, I declare
problem_transformation(p::DerisoProblem) =
as((logit_h = asℝ, K = asℝ, (F = Array, nrow(p.catch_df) - 1)))
How can I declare each element of F
asℝ₋
?
My naive attempt
problem_transformation(p::DerisoProblem) =
as((logit_h = asℝ, K = asℝ, (F = asℝ₋.(Array, nrow(p.catch_df) - 1))))
fails when I try to create a TransformedLogDensity
julia> P = TransformedLogDensity(problem_transformation(derisoproblem), derisoproblem)
ERROR: MethodError: no method matching (::TransformVariables.ShiftedExp{false,Float64})(::Type{Array}, ::Int64)
Closest candidates are:
ShiftedExp(::Any) at /home/jkbest/.julia/packages/TransformVariables/I4viB/src/utilities.jl:51
Stacktrace:
[1] _broadcast_getindex_evalf at ./broadcast.jl:574 [inlined]
[2] _broadcast_getindex at ./broadcast.jl:557 [inlined]
[3] getindex at ./broadcast.jl:507 [inlined]
[4] copy at ./broadcast.jl:758 [inlined]
[5] materialize at ./broadcast.jl:748 [inlined]
[6] problem_transformation(::DerisoProblem{DataFrame,DataFrame}) at ./REPL[211]:1
[7] top-level scope at none:0
Thanks!