Regression using 1x6 table with 500x20 double elements
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hinti123
el 9 de Nov. de 2018
Comentada: Hinti123
el 11 de Nov. de 2018
Hi all, i want to do a linear regression using fitlm. I created a table with 6 variables. The table consints of one row where each variable stores 500x20 double elements. I now want to do a linear regression with Var1 as Y and Var2-Var6 as X. So it should look like this:
Var1(row,i)=(alpha)+(beta1)*Var2(row,i)+(beta2)*Var3(row,i)+...
This has to be done for each row separate. So in the endeffect I should have 1 alpha and 5 Betas for 500 rows. That is my regression command i am trying to execute
fitlm(Mytable,'Var1~Var2+Var3+Var4+Var5+Var6');
But i keep getting this error
Error using classreg.regr.FitObject/selectVariables (line 293)
Predictor variables must be numeric vectors, numeric matrices, or categorical vectors.
Can you please help me? Thanks
0 comentarios
Respuesta aceptada
Jeff Miller
el 11 de Nov. de 2018
I'm not sure I fully understand your question, but maybe this will help: If you want one alpha and five betas for each of the 500 rows separately, then you will have to call fitlm 500 times. Each time you call it, you should pass only the data for one row.
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!