Save regression output (fitlm) into table
29 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
Is there any way to save the output from multiple linear regression into a table? (I don't mean exporting it into excel).
So for example, if I use the patients data set and calculate regression of weight and age on diastolic blood pressure, is there a way to save "Model_1" into a table (a table within matlab)? I realize that the output already looks like a table, but I mean an "actual" table (something like table (a, b, c, ..... ) ).
Many thanks!
P.S.: this is not a homework assignment, I just want to know if it's possible and if so, how to do it :)
load patients Weight Age Diastolic
x = [Weight, Age];
Model_1 = fitlm (x, Diastolic, 'VarNames', {'Weight', 'Age', 'DBP'})
0 commentaires
Réponses (2)
David Hill
le 19 Mai 2022
Save in a cell array. I might not be understanding you completely.
for k=1:10
Model=%your code
c{k}=Model;
end
0 commentaires
Nathan
le 15 Sep 2023
If you're looking for what I was looking for Model_1.Coefficients contained a table of coefficients
load patients Weight Age Diastolic
x = [Weight, Age];
Model_1 = fitlm (x, Diastolic, 'VarNames', {'Weight', 'Age', 'DBP'})
Model_1.Coefficients
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!