Avoiding loops in bootstrap
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I've nested loops to bootstrap a statistical test results. The code works but it's very slow. Is there a way to improve the below a structure and speed up the code:
for jj = 1:nreplications
Y_artificial %Simulate artificial data;
% Nested loop
for
%Perform test on recursive sub-samples of Y_artificial
end
end
0 comentarios
Respuestas (1)
Adam Danz
el 22 de Oct. de 2020
Bootstrapping is an iterative process. Even if you use a method that doesn't require you to write a loop, the functions you're using will very likely use loops.
Loops likely aren't the bottleneck in your code. Something else it. You could use Matlab's profiler to time your code and produce a summary of time consumption.
Also note Matlab's bootstrapping functions
but depending on what you're bootstrapping, it may be easier to built it yourself.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!