Can I use fitnlm inside the splitapply command?
1 view (last 30 days)
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.
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).
Div Tiwari on 8 Aug 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'.