필터 지우기
필터 지우기

How to do Multivariate Regression Analysis in Matlab

조회 수: 2 (최근 30일)
Sebastian Daneli
Sebastian Daneli 2021년 11월 10일
답변: Sahil Jain 2021년 11월 16일
Let's say that I have the model
and the data
X=[1 1 1 1 1; 0 1 2 3 4]';
Y=[1 4 3 8 9; -1 -1 2 3 2]';
How can I fit and evaluate this multivariate data in Matlab?
  댓글 수: 1
Sargondjani
Sargondjani 2021년 11월 10일
X(:,1) consists of constants, so I assme you want to regress:
a1 = regress(Y(:,1),X);
a2 = regress(Y(:,2),X);
If you really want to regress Y(:,1) on X(:,1) you will only estimate the mean (since X(:,1) consists of ones). Note that B(0,1) and B(1,1) are collinear, in that case.

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

채택된 답변

Sahil Jain
Sahil Jain 2021년 11월 16일
Hi Sebastian. You can use the "mvregress" function to do multivariate linear regression in MATLAB.
X=[1 1 1 1 1; 0 1 2 3 4]';
Y=[1 4 3 8 9; -1 -1 2 3 2]';
beta = mvregress(X,Y)
beta = 2×2
1.0000 -1.0000 2.0000 1.0000

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by