Can I use fitnlm inside the splitapply command?

1 visualización (últimos 30 días)
Francisco GarcesVega
Francisco GarcesVega el 25 de Jul. de 2016
Respondida: Div Tiwari el 8 de Ag. de 2016
Can I use fitnlm inside the splitapply command?, if so can you provide the right syntaxis or command line. I had try several and keep getting error in the line. I have use this form, or the same form setting the anonymous funcction before the splitapply line but get the same error.
yw=splitapply(@fitnlm,DataD.time,DataD.logNN0,@(b,x)-(x/b(1)).^b(2),[2 .7],G)
The data variables must have the same number of rows as the vector of group numbers. The group number vector has 259 row(s), and data variable 3 has 1 row(s).
Thanks

Respuestas (1)

Div Tiwari
Div Tiwari el 8 de Ag. de 2016
The 'splitapply' function requires all data input arguments to have the same length as G if the data is a vector, or have their number of rows or columns equal the length of G, depending on the orientation of G. Please use 'repmat' for the function handle and coefficients of the model in order to meet this requirement.
Additionally, if the 'func' input to 'splitapply' returns a nonscalar output argument, the argument must be oriented so that splitapply can concatenate the output arguments from successive calls to 'func'. Since 'fitnlm' returns a NonLinearModel object, you may define an anonymous function to call fitnlm, and then return the estimate from the resulting fitted model object. You can then use its handle as the first input argument to 'splitapply'.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by