How can I compute regression coefficients for two or more output variables?
Mostrar comentarios más antiguos
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 comentarios
the cyclist
el 6 de Sept. de 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
el 7 de Sept. de 2012
the cyclist
el 8 de Sept. de 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.
Respuesta aceptada
Más respuestas (1)
Greg Heath
el 5 de Sept. de 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 comentarios
the cyclist
el 6 de Sept. de 2012
Shouldn't that slash be mldivide (\) rather than mrdivide (/)?
Tim Bennett
el 6 de Sept. de 2012
Categorías
Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!