Constraints on Parameter Estimation

조회 수: 3 (최근 30일)
Faizan Lali
Faizan Lali 2023년 3월 11일
댓글: Torsten 2023년 3월 13일
I am trying to fit linear regression model and predict parameters without intercept. I have written my code as under;
tbl=table(yobs,x1,x2,x3);
mdl = fitlm(tbl,'yobs ~ x1 + x2 + x3 - 1')
but I am getting the estimates which are negative but in my model all parameters should be positive. LB>=0 and UB=inf. How to set these constraints while doing the prediction.

채택된 답변

Torsten
Torsten 2023년 3월 11일
Use lsqlin instead of fitlm.
  댓글 수: 6
Torsten
Torsten 2023년 3월 13일
This is the best fit you can get without intercept and the constraints you want to impose on the parameters.
Torsten
Torsten 2023년 3월 13일
According to the documentation,
yobs ~ x1 + x2 + x3 - 1
means a three-variable linear model without intercept.
Thus the "-1" just means: no constant term, not
yobs = p1*x1 + p2*x2 + p3*x3 - 1
Very confusing.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Nonlinear Regression에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by