Misunderstanding Matlab's Bootstrap Example (bootstrp and bootci)

6 次查看(过去 30 天)
And while the bootstrap iterations are 1000 when using bootsrp
rhos1000 = bootstrp(1000,'corr',lsat,gpa);
"This resamples the lsat and gpa vectors 1000 times and computes the corr function on each sample."
they then use 5000 for the confidence interval later when using bootci
ci = bootci(5000,@corr,lsat,gpa)
The documentation for bootci says: "ci = bootci( nboot,bootfun,...) computes the 95% bootstrap confidence interval of the statistic computed by the function bootfun. nboot is a positive integer indicating the number of bootstrap samples used in the computation."
Shouldn't both have the same number?
rhos1000 = bootstrp(9999,'corr',lsat,gpa);
ci = bootci(9999,@corr,lsat,gpa);
Thanks!!

回答(1 个)

Ayush
Ayush 2024-9-25
Hi @AC,
The link for the example you provided is not functioning but I understand that you want to know why there are different samples used for “bootstrp” and “bootci” functions.
It's common in practice to utilize different sample sizes for these functions:
1. “bootstrp” function samples and computes the desired statistic for each iteration. The choice of 1000 iterations here is typically sufficient for estimating the distribution of statistic, especially if sample size is large enough.
2. In Contrast, the “bootci” function is specifically designed to compute the confidence interval based on bootstrap resampling. It often employs a larger number of bootstrap samples (such as 5000 as in the example) to provide a more accurate estimate of the statistic's variability. This approach enhances the reliability of the confidence intervals by smoothing out estimates and mitigating the effects of randomness present in smaller bootstrap samples.
While it is technically feasible to use the same number of samples for both functions, the decision to use a higher number for bootci is made to improve the precision of the confidence interval. This practice strikes a balance between computational efficiency and the robustness of statistical estimates.
If you prefer consistency and have the computational resources available, you are welcome to use the same number for both functions.
For further details, you can refer to the documentation for the “bootstrp” function here: https://www.mathworks.com/help/stats/bootstrp.html and for the "bootci" function here: https://www.mathworks.com/help/stats/bootci.html
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by