Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to find the multiple linear regression coefficients for this case?
1 次查看(过去 30 天)
显示 更早的评论
I have three matrices each of 3420 rows and 28 columns, namely, y, x1, and x2. I want to build a multiple linear regression such that:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/784033/image.png)
I wanted to know the multiple linear regression coefficients
and
each of them will be arrays of 3420 rows and 1 column. How to do it?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/784038/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/784043/image.png)
I tried the following code:
y=rand([3420,28]);
x1=rand([3420,28]);
x2=rand([3420,28]);
n = 3420;
b = zeros(n,4);
X=zeros(n,4);
for i=1:n
X(i,4)=[ones([28,1]) x1(i,:)' x2(i,:)' (x1(i,:).*x2(i,:))'];
b(i,4)=(regress(y(i,:)',X(i,4)))';
end
Kindly help me with the same.
1 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!