Borrar filtros
Borrar filtros

fitlm - only positive coefficients

19 visualizaciones (últimos 30 días)
Tobias Grempels
Tobias Grempels el 24 de Oct. de 2022
Comentada: Torsten el 24 de Oct. de 2022
Hi
I made a linear regression Model with fitlm. Some of the calculated coefficients are negative. In my Project this doesnt make sense. Is there an opportunity to set Boundaries for the coefficients or only allow positive ones?
Thank you!

Respuestas (1)

Torsten
Torsten el 24 de Oct. de 2022
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.
  2 comentarios
Tobias Grempels
Tobias Grempels el 24 de Oct. de 2022
Here i need some help. How can i use lsqlin for optimizing my r-squared?
Torsten
Torsten el 24 de Oct. de 2022
The r-squared is only optimized in the model with no bounds on the regression coefficients.
You can compute the r-squared after fitting with lsqlin and with the bound constraints on the parameters, but it will of course be smaller than the optimal one.

Iniciar sesión para comentar.

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by