Closed GabrielHoffman closed 2 years ago
Hi Gabriel,
Indeed you are right. This could be attributed to the step size of Newton-Raphson. I implemented the simple Newton-Rapshon algorithm, so that might be the case as it seems that the parameters tend to "explode". I need to check this more thorougly, but not for a while as I am busy right now. If you think you help with the NR algorithm, then be my guest.
I have a fix where I use the log-likelihood and its gradient in optim()
using L-BFGS-B
. It converges quickly and works well. It is also dramatically faster than dirmult::dirmult()
.
I'm happy to contribute the code to Rfast
if you are interested.
Cheers, Gabriel
My issue with optim is that it is drammatically slower than Newton-Raphson. In general we do not use the optim() function in Rfast. Is your gradient the same as mine? Can you please send it to my email? I might have to revisit my computations and or modify them.
Hi Gabriel.
I fixed it and it is really fast.
$iters [1] 14
$loglik [1] -1082198
$param [1] 102.161498 5.081866 41.066845
I have now added your name in the acknowledgements.
I have used Rfast in many applications. I would like to use
dirimultinom.mle()
to estimate the parameters from a Dirichlet Multinomial model. Other packages also provide this capability, but are very slow. I figuredRfast
would provide a fast method, but it gives incorrect results.I am interested in large scale analysis, but here is a minimal reproducible example showing the problem.
To Reproduce Here is a simple example to simulate counts from Dirichlet Multinomial.
dirmult::dirmult
estimates thealpha
parameters correctly, butdirimultinom.mle
does not.Additional info
dirimultinom.mle
does work for some datasets, but when it fails it only uses 2 iterations. Looking at the code, it looks like the function uses Newton's method. I modified the code to use the truealpha
values as a starting point, but the didn't fix the issue. Maybe the step size of the Newton update is should be reduced?Desktop (please complete the following information):
x86_64-apple-darwin19.6.0
R 4.1.1
Rfast 2.0.4