This is a much better solution. Once we've found the MLE, reparametrize to avoid the cumsum thing. The only reason we can't do that during the optimization phase is that that would potentially involve negative probabilities, which would mess up the log-likelihood. But the MLE will actually be well formed so this works fine.
There's a wacky minor issue I still need to resolve which is that the second derivative of the last values of z ends up being enormous. Not sure why, will figure out what's causing it.
Coverage increased (+0.3%) to 86.445% when pulling 4c73e9d8c7de5c6ea6a5217aa6212ea3aa332e6f on nonparametric-reparametrize into 6206cbfed9570a3cb62d48052da035caa0388574 on master.
This is a much better solution. Once we've found the MLE, reparametrize to avoid the cumsum thing. The only reason we can't do that during the optimization phase is that that would potentially involve negative probabilities, which would mess up the log-likelihood. But the MLE will actually be well formed so this works fine.
There's a wacky minor issue I still need to resolve which is that the second derivative of the last values of
z
ends up being enormous. Not sure why, will figure out what's causing it.Weibull fit on Weibull data:
Nonparametric fit on the same data: