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!