Can you use Batched partitioned nonlinear least squares to fit 5 parameters?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gina Carts
am 9 Apr. 2018
Bearbeitet: Gina Carts
am 20 Apr. 2018
Hi,
I've seen people using the batched partitioned nonlinear least squares to solve nonlinear problems of two unknown parameters.
I have a function with 5 unknown parameters and I want to fit it nonlinearly. I fitted my model using the lsqnonlin but is extremely slow.
I was looking for solutions on how to speed It up and I came across with the batched partitioned nonlinear least squares but I am not sure if I can use it in case of 5 unknown parameters.
Thank you in advance.
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 9 Apr. 2018
As the person who introduced the concept of batched partitioned nonlinear least squares here, I'll assume you are asking about using my BATCHPLEAS utility, found on the file exchange.
Yes, in theory, you can use it to solve problems with any number of parameters. Of course, theory and practice need not always coincide. There is no limit (implicit or explicit) on the number of parameters you can estimate.
But first, are you talking about a problem with 5 NONLINEAR parameters, thus really more variables that that? Or as is common in this arena, if you have 5 total variables, then you might have 2 or 3 nonlinear parameters to estimate, but the remainder linear, so 5 total parameters? Remember that the partitioning reduces the search space for the estimation.
If you have no clue as to what partitioned nonlinear least squares is, or how it works, and the docs provided with BATCHPLEAS and/or FMINSPLEAS do not help you enough, then one of the chapters in the Seber & Wild book on nonlinear regression do cover the concept. And since Bates & Watts were the people who wrote the original papers on the topic as I recall, I'd bet that the book by Bates & Watts on nonlinear regression does so too. I think Seber and Wild called the idea something like separable nonlinear least squares.
Next, remember that regardless of how many nonlinear parameters there are in your problem, that nonlinear regression is often sensitive to starting values. BATCHPLEAS presumes the SAME set of starting values will be used for every member of the set. Problems with many nonlinear parameters might have local solutions that are not the global optimum. Or in some cases, some sub-problems might diverge, again due to sensitivity to the starting values. The more variables you have, the more risk there is in this happening. If partitioning does reduce the search space, so that in reality, you have only 2 or 3 unknowns, then the partitioning typically also increases the robustness of the problem, so it is less sensitive to the need for good starting values.
5 Kommentare
John D'Errico
am 11 Apr. 2018
No. First, making batchsize to be as large as 1000 will probably not be fast. It may even be slower than a loop that processes each data set separately.
As I explained, batchsize for 4 nonlinear variables will probably be best somewhere between 25 and 200. The code will do the work for you. I might try 50 or 100 to see how it does.
Next, there is only ONE function in funlist here, since there is only ONE linear variable. Also you will pass in ONE array of independent variables. I'll all it xy.
You also need to learn about the use of .* and ./ as operators. You can freely multiply or divide anything by a scalar variable. But if you multiply two vectors, then you need to use .* to do element-wise multiplication. Likewise, ./ is needed if you divide one vector into another element-wise, or if you divide a scalar by the elements of a vector.
xy = [x(:),y(:)];
funlist = {@(p,xy) (p(2) * exp(-xy(:,1)*p(3) - xy(:,2)/p(4))+(1-p(2)).*exp(-xy(:,1)*c1).*(p(5)*exp(-xy(:,2)/c2)+(1-p(5)).*exp(xy(:,2)/c3)))};
I think I got that right. At least, MATLAB accepts it as valid syntax.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!