Implementing bootstrap for grouped data

조회 수: 10 (최근 30일)
G Diaferia
G Diaferia 2017년 2월 3일
% 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개)

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by