Update: The original question is: Is there an R function using the same algorithm implemented in the "lsqnonlin" function in matlab? However, the answer is more related to searching a function in R. I think the answer is in general very helpful for R users. So I edited the title but asked the original question again here: In R, how to do nonlinear least square optimization which involves solving differential equations?
I am doing nonlinear least-square optimizations and found that the matlab function lsqnonlin performs better than all the optimization algorithms I tried in R (including the algorithms in function optimx, nlm, nlminb, solnp, etc.) in the sense that it is faster and found the "more correct" solution.
However, I did not find an implementation of the 'trust-region-reflective' algorithm in R that is used in Matlab. Does someone know if there is already an implementation? Also, is it always true that the 'trust-region-reflective' algorithm is a better algorithm for this kind of optimization?
It sounds like lsqnonlin in the pracma package is what you're looking for.
I recommend installing the sos package for R. Its purpose is to help you answer questions like 'Is there a function out there that does this?'. findFn in this package will search what's on CRAN for the term you supply.
library(sos)
findFn('lsqnonlin')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With