필터 지우기
필터 지우기

What constrained regression function shuld I use?

조회 수: 1 (최근 30일)
Simon Wang
Simon Wang 2015년 3월 13일
답변: Simon Wang 2015년 3월 15일
I have a regression model log (r(i)) = a + b * log(A(i)) where A(i) is a vector and each element is known. Log is the nature log.
I need to find out a, b, and each element of r(i) such that the sum of r(i) equals to a constant k and the sum of error, i.e. sum(square[log (r(i)) – (a + b * log(A(i)))]) is minimized. Both a and b are scalars.
What regression model can I choose?

채택된 답변

Simon Wang
Simon Wang 2015년 3월 13일
편집: Simon Wang 2015년 3월 13일
Also, if this really works, do I need to have specific toolboxes? Do I need to an implement specific solver?
Thanks!
Simon

추가 답변 (3개)

Torsten
Torsten 2015년 3월 13일
Choose a and b such that
exp(a)*(A(1)^b+A(2)^b+...+A(n)^b)=k
Then sum (exp(a)*A(i)^b) = k is satisfied.
Now define r(i) = exp(a) * A(i)^b, and you are done.
Best wishes
Torsten.

Simon Wang
Simon Wang 2015년 3월 13일
편집: Simon Wang 2015년 3월 13일
Thanks!
exp(a)*(A(1)^b+A(2)^b+...+A(n)^b)=k and sum (exp(a)*A(i)^b) = k are the same equation.
So there are two unknowns a and b and only one equation, I did not see the way to get the unique a and b.
Note:
1) a and b are scalars
2) Condition is not used: sum(square[log (r(i)) – (a + b * log(A(i)))]) is minimized
Thanks!
Simon
  댓글 수: 1
Torsten
Torsten 2015년 3월 13일
Choose b=1, a=log(k/(A(1)+A(2)+...+A(n))) and define r(i)=exp(a)*A(i).
Then sum(square[log (r(i)) – (a + b * log(A(i)))]) is minimized (because it equals 0) and sum r(i)=k.
Best wishes
Torsten.

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


Simon Wang
Simon Wang 2015년 3월 15일
THank you for the response. I think it should work and this leads me to change my question a little bit because it will make more sense in real world scenarios. I will post another question and close this one. Thank you very much for the help.

Community Treasure Hunt

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

Start Hunting!

Translated by