How can I compute regression coefficients for two or more output variables?
Show older comments
Is it possible for me to have two output variables using multiple linear regression? For example, computing the coefficients between mean free joint angles (x1 = hip, x2 = knee, x3 = ankle) as predictor variables (X) and changes in the mean-free foot centre of mass as an outcome variable (y) in the x-axis dimension (y1) and y-axis dimension (y2)?
Would I then enter the data as y1 + y2 = y and use the B = X\y'; equation to give me the coefficient estimates in a [2 x 3 ] matrix (i.e. 2 columns for the x and y axis and 3 rows for the hip, knee and ankle joints)?
Any help would be appreciated.
3 Comments
the cyclist
on 6 Sep 2012
Tim, please see my comment on Star Strider's answer. When you say "two or more output variables", are you just looking for the calculational convenience of running those in parallel, or do you want a true multivariate regression?
Tim Bennett
on 7 Sep 2012
the cyclist
on 8 Sep 2012
Your Y array will stay in the same format, but the mvregress() function requires a specific cell array format for the input of X. With full disclosure that I am not experienced at using this particular function, I can only suggest you pore over the example given in
> doc mvregress
to understand the syntax. Also, I found this example on the support site:
I hope these will help.
Accepted Answer
More Answers (1)
Greg Heath
on 5 Sep 2012
If
[ N I ] = size(X)
[ N O ] = size(Y)
the linear model is
Y = [ones(N,1) X ] * B
where
B = Y / [ones(N,1) X ]
and
[ I+1 O ] = size(B)
Hope this helps.
Greg
2 Comments
the cyclist
on 6 Sep 2012
Shouldn't that slash be mldivide (\) rather than mrdivide (/)?
Tim Bennett
on 6 Sep 2012
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!