fitlm when there are many independent variables

3 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 12 月 13 日
回答済み: Image Analyst 2020 年 12 月 14 日
shows, when one has a small number of independent variables, it is possible to have an output table with variables are named with its orginal name intead of x1, x2,... But, in my case, there are like 20 independent variables, and it is a bit cumbersome to write all the variable names. Then, how can one get the output table of the form
Estimate Coefficients
Estimate SE Tstat pValue
---------------------------------------
(Intercept)
January
February
March
...

回答 (1 件)

Image Analyst
Image Analyst 2020 年 12 月 14 日
Use the 'VariableNames' option of table(). Writing 20 names into a cell array is not cumbersome. Some of my programs have thousands of lines.
t = table(v1, v2, v3, v4, 'VariableNames', {'Jan', 'Feb', 'Mar', 'Apr'}); % Modify to include all 20 variables.
Attach your data if you still have trouble.

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by