Bootstrap simulations to estimate 95% bootstrapped CIs for the prevalence of debris obtained with different sample sizes.
plastic.ci(plastic_abs_pres, max_sample_size = 300, bs_rep = 1000,
lower_ci = 0.025, upper_ci = 0.975)numeric vector, containing a binary values with 0 or no for absence of plastic, and 1 or yes for presence of plastic.
integer, specifying the maximum number of samples to use for estimating the prevalence of plastic debris. By default 300 samples. Increasing sample sizes substantially increases computational time.
integer, specifying the number of bootstrap replications. By default 1000 replications.
numeric, specifying lower confidence interval. By default 2.5%, based on Efron and Tibshirani (1993)
numeric, specifying upper confidence interval. By default 97.5% default, based on Efron and Tibshirani (1993).
A list (cidtf) with a data frame with sample sizes, mean CI, lower CI, upper CI, and a matrix (prevprob) with prevalence probability of plastic debris for all sample sizes and their estimated prevalence of debris.
Efron, B., & Tibshirani, R. (1993). An introduction to the Bootstrap. Boca Raton: Chapman & Hall.
# NOT RUN {
plastic.ci(rbinom(1000,1,0.5), 30, 100)
# }
Run the code above in your browser using DataLab