Implementing bootstrap for grouped data
10 次查看(过去 30 天)
显示 更早的评论
% 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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!