Can I use fitnlm inside the splitapply command?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Div Tiwari
2016-8-8
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'.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!