fitlm - only positive coefficients

조회 수: 5 (최근 30일)
Tobias Grempels
Tobias Grempels 2022년 10월 24일
댓글: Torsten 2022년 10월 24일
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!

답변 (1개)

Torsten
Torsten 2022년 10월 24일
Use "lsqlin" instead. Here, you can set upper and lower bounds for the parameters.
  댓글 수: 2
Tobias Grempels
Tobias Grempels 2022년 10월 24일
Here i need some help. How can i use lsqlin for optimizing my r-squared?
Torsten
Torsten 2022년 10월 24일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by