Implementing bootstrap for grouped data
10 views (last 30 days)
Show older comments
% nboot = number of samples % fun = function for computing statistics on each sample % data = data which needs to be organized in groups according to the grouping variable GrVar. The bootstraping needs to be applied to each of these groups
function GRbootstat = grpbootstrp(nboot, fun, data, GrVar)
GRbootstat = cell(1,size(unique(GrVar),1)); for i = 1:size(unique(GrVar),1); GRbootstat(1,i) = {zeros(nboot,1)}; end
f = @(x)(bootstrp(nboot,feval(fun,x),x));
%f = feval(bootstrp(nboot,feval(fun,data),data)); GRbootstat = splitapply(f, data, findgroups(GrVar));
end
0 Comments
Answers (0)
See Also
Categories
Find more on Time Series in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!