run multiple linear regression using fitlm without create new table?

3 ビュー (過去 30 日間)
Liqun
Liqun 2016 年 12 月 21 日
編集済み: Liqun 2016 年 12 月 22 日
I have a large table (500000 rows X 26 columns), there are two category variables, say c1 with value +1, 0 and -1; c2 with value a, b, and c. I need to run 16 regressions using fitlm, which are listed in the table
ALL a b c
ALL
+1
0
-1
(ALL, ALL) means using all the data in the table;
(ALL, a) means using data c2 = a, c1 can be any;
(+1, a) means using data c1 = +1 and c2 =a;
so on and so forth.
Right now in my mind, I can pull out the sub-table 16 times from the large tabel, then run the regression.
My question: is there any more efficient way to do this, without creating 16 sub-tables?
Thanks!

回答 (1 件)

David Barry
David Barry 2016 年 12 月 21 日
編集済み: David Barry 2016 年 12 月 21 日
If you need to operate on a subset of the data then ultimately you will need to create that subset of the data. You could try using a categorical array to reduce your memory footprint though.

カテゴリ

Help Center および File ExchangeRegression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by