How to use splitApply to get the coefficients of fitlm?

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!

Réponses (1)

dpb
dpb le 16 Oct 2018

0 votes

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 commentaires

JFz
JFz le 16 Oct 2018
Thanks. I did. I wrote a function linest to take in one input dummyTable, but still get too many input arguments.
dpb
dpb le 16 Oct 2018
Can't debug what we can't see... :)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange

Produits

Version

R2018a

Tags

Question posée :

JFz
le 16 Oct 2018

Modifié(e) :

dpb
le 17 Oct 2018

Community Treasure Hunt

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

Start Hunting!

Translated by