Asked by Matthew
on 16 Mar 2013

The documentation for function "mvregress" states that the return value "beta" is a *vector* of the regression coefficients. Looking deeper into "Multivariate Normal Regression", we see that matlab uses the same regression coefficients ("beta") *for every dimension of the multivariate response variable Y*

This is ludicrous. Of course each component of the response variable can have its own set of coefficients. THAT is multivariate linear regression.

Am I missing something? Is this just an inherent shortcoming in matlab's "mvregress" function? If so, what a bizarre design choice...

Is there some way to get *real* multivariate linear regression, i.e. get a *matrix* beta of regression coefficients?

*No products are associated with this question.*

Answer by the cyclist
on 16 Mar 2013

Edited by the cyclist
on 16 Mar 2013

Accepted answer

You are missing something. See my answer in this thread for several examples of using design matrices with mvregress():

There are also examples from MathWorks here: http://www.mathworks.com/help/stats/mvregress.html

Tom Lane
on 16 Mar 2013

Just to follow up on the cyclist's answer (from my MathWorks perspective), mvregress is admittedly confusing. You might be expecting a coefficient matrix such as you would get from B=X\Y. But mvregress requires that you set up X as a cell array to do this. A benefit of that is that you have more flexibility, so for example you can constrain some coefficients to be the same across the columns of Y. But there is a cost of a less-than-simple interface. Rest assured that it is multivariate, in that it takes into account covariance across the Y columns.

You want B to be a P-by-Q matrix. If you set things up properly, B will be a (P*Q)-by-1 vector with all the same elements that you want. You can reshape it to P-by-Q.

Let me know if the references the cyclist points out aren't sufficient to explain how to set up X. I'm hoping we will make mvregress simpler in the future.

Anoosh
on 23 Jan 2016

@thecyclist I am trying to use mvregress with the data I have with dimensionality of a couple of hundreds. (3~4). Using 32 gb of ram, I can not compute beta and I get "out of memory" message. I couldn't find any limitation of use for mvregress that prevents me to apply it on vectors with this degree of dimensionality, am I doing something wrong? is there any way to use multivar linear regression via my data?

the cyclist
on 23 Jan 2016

@Anoosh:

Although this is a perfectly sensible place to ask this question, you won't actually get much attention from a comment buried in a 3-year-old thread.

I suggest you ask a new question. If you can actually attach files with your data and code, that will help people diagnose your issue.

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 2 Comments

## Ricardo Arévalo (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/67399#comment_399633

try regress function

## Ricardo Arévalo (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/67399#comment_399640

If you use regress, remember to add a column of ones to indicate that there is a constant in your regression model.

I leave an example: