Implementing bootstrap for grouped data
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
% 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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Time Series dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!