Estimating multiple parameters from a regression

조회 수: 1 (최근 30일)
ektor
ektor 2019년 5월 24일
댓글: Star Strider 2019년 5월 24일
Dear all,
I have this regression model
fy=randn(1000,1);
x1=randn(1000,1);
x2=randn(1000,1);
u=randn(1000,1);
fy=a*x1+b*x2+c*u; %regression model
where fy is the dependent variable,
x1 and x2 are the independent variables,
u is the error term which is standard normally distributed,
a and b are the coefficients
and c is the square root of the variance.
My goal is to estimate the scalars a,b and c. Is there a way to do that?

채택된 답변

Star Strider
Star Strider 2019년 5월 24일
That is a simple linear regression.
Try this:
B = [x1 x2 u] \ fy;
a = B(1)
b = B(2)
c = B(3)
  댓글 수: 2
ektor
ektor 2019년 5월 24일
Does it make sense to minimize the sum of squared residuals?
Star Strider
Star Strider 2019년 5월 24일
Yes. However to do that you likely have to introduce an intercept term as well:
B = [x1 x2 u ones(size(u))] \ fy;
a = B(1)
b = B(2)
c = B(3)
I = B(4)
It just depends on what you want to do with your model.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by