How to use splitApply to get the coefficients of fitlm?

1 回表示 (過去 30 日間)
JFz
JFz 2018 年 10 月 16 日
編集済み: dpb 2018 年 10 月 17 日
Hi,
I have a table dummyTable that I would like to findgroup and then splitApply. The function in the splitApply is fitlm. So I write it as:
fit = splitapply(@(x)fitlm(x, Y~X+Dummy'), dummyTable, G);
But I keep getting an error: "Too many input arguments." Why? Thanks for any help!

回答 (1 件)

dpb
dpb 2018 年 10 月 16 日
splitapply can only take a function handle, not an anonymous function. You'll have to write an intermediary function that calls fitlm with the wanted model and pass the handle to it.
  2 件のコメント
JFz
JFz 2018 年 10 月 16 日
Thanks. I did. I wrote a function linest to take in one input dummyTable, but still get too many input arguments.
dpb
dpb 2018 年 10 月 16 日
Can't debug what we can't see... :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnalysis of Variance and Covariance についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by