Thanks a lot for good suggestions. But at least I got quite confused.
Population PK model may be simplistically expressed as a two level
where y_it - plasma concentration for individual i at time t
f - system of ODEs
theta - population parameter
At leas the system of ODEs I have (PBPK) model gives a very good fit -
as verified by predictive posterior - but gives bunch of divergencies.
theta is in reality vector for which some parameters have literature
values while some don't. Thus I used quite vague prior for those which
don't and informative prior for those which do.
Then I reparametrized the model:
and ran 4 chains. 3 chains showed a very good mixing but one chain was
like pig tail and was visibly outside the region defined by well mixed
chains. Well mixed chains didn't have any divergencies but pig tail
chain had a lot of divergencies. Also, well mixed chains didn't have any
normal_log: Location parameter is 1.#QNAN, but must be finite!
errors after warmup but pig tail chain had them up to the end of
simulation. Those I guess were caused by function f giving nans for
nonsensical parameter values.
Then I did one more experiment - hard constrained parameters based on
ranges as determined from centered parametrization (first model). As a
result there were no divergenciens, perfect mixing etc. However, as I
understand hard constrains are not recommended. But I don't know other
way how to remove pig tails (except ignoring them).
One more possibility for divergencies might be a very strong correlation
between parameters but it seems this correlation doesn't cause
divergencies for non centered parametrization (second model).
Second model is attached. I appreciate any feedback. It runs for 5 days
(even when jacobian is supplied to CmdStan, thanks to Sebastian). By the
way, pig tail chain occurred for ncp model when jacobian was not
pbpkauto.stan (11.5 KB)