non linear regression model with constraints
Mostrar comentarios más antiguos
I have a set of data that I want to fit with a non linear regression model. The regression function is y=k*x.^alpha (I usually use fitnlm). I would like to put a constraint on the area under the curve. I tried computing the integral and making a substitution but when alpha is close to -1 (and it is my case), the integral has a different expression and thus I do not know how to express the area in a way that works for alpha=-1 and for alpha different from -1. Many thanks in advance
2 comentarios
Kaushik Lakshminarasimhan
el 24 de Ag. de 2018
Editada: Kaushik Lakshminarasimhan
el 24 de Ag. de 2018
Can you share your code where you define the constraint for the case when alpha is far away from -1?
FastCar
el 24 de Ag. de 2018
Respuesta aceptada
Más respuestas (2)
If you know alpha is very close to -1 (nearly within numerical precision), replace the regression function with y=k*T(x,alpha) where T(x,alpha) is a Taylor expansion of x^alpha about alpha=-1.
2 comentarios
FastCar
el 24 de Ag. de 2018
No, but if you follow the approach with the Taylor expansion, there is no need for fmincon. You can use the area constraint to eliminate k, just as you were planning to do originally.
Alternatively, solve first with fmincon. Then plug the alpha you get as the initial point beta0 for fitnlm. Here, you have prior knowledge of whether alpha=-1 or not and so can choose the expression for A accordingly. Since you are initializing fitnlm with the known solution, it should converge in few or zero iterations and give you the goodness of fit metrics.
Matt J
el 26 de Ag. de 2018
If you know a prior that alpha is very close to -1, maybe you should just bound the optimization to a small interval -1-delta <= alpha <= -1+delta around -1. Then you can just approximate the area as constant over that interval,
A=k*log(x2/x1)
and eliminate k from the optimization,
k=A/log(x2/x1)
2 comentarios
FastCar
el 26 de Ag. de 2018
Well, that's the same as saying you don't really have any a priori knowledge of where alpha lies. That takes you back to my original proposal, which is a generic solution.
Categorías
Más información sobre Linear and Nonlinear Regression en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!