G'day Troels,
On Mon, 6 Nov 2023 20:43:10 +0100
Troels Ring <[email protected]> wrote:
> Thanks a lot! This was amazing. I'm not sure I see how the conditiion
> pK1 < pK2 < pK3 is enforced?
One way of enforcing such constraints (well, in finite computer
arithemtic only "<=" can be enforced) is to rewrite the parameters as:
pK1 = exp(theta1) ## only if pK1 > 0
pK2 = pK1 + exp(theta2)
pK3 = pk2 + exp(theta3)
And then use your optimiser to optimise over theta1, theta2 and theta3.
There might be better approaches depending on the specific problem.
Cheers,
Berwin
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.