Open bob-carpenter opened 3 years ago
I forgot to remove the T[0, ]
from the Cauchy priors. Those aren't necessary because he prior scales are data variables and the variates are properly constrained. Removing the truncations avoids a call to the Cauchy cdf.
I refactored your Stan model, but didn't bother to create a PR because I didn't know if the model was still live. I made a bunch of changes:
process_sd
else
s in the function definitionlog1m_exp
because it factors out then just adds a constant to the target, which can be droppedlog_lambda
andlog1m_lambda
, usinglog_mix
function to simplify mixture (though the way you had it may be a bit more efficient)I verified that it compiles, but didn't check that it works. The changes are all simple local transforms, but obviously one would want to verify that I did the algebra correctly.
What really needs to happen to make this more statistically efficient (in an effective sample size per iteration sense) is to use a non-centered parameterization for the hierarchical priors. That's tricky for positive-constrained parameters, but we're working on allowing
<lower = 0, offset = mu, multiplier = sigma>
to do that more easily. To do it without being able to combine the transforms requires a lot of manual labor, especially given the half-normal prior. Non-centering is easier with lognormal because then it's just the analog of the non-centered parameterization for unconstrained variables; as the model here has it, one would need to work out the implied location and scale of the half-normal variables on the unconstrained scale.