Title: | PLastic ACcumulation Estimate using R (PLACER) |
---|---|
Description: | Assessment of the prevalence of plastic debris in bird nests based on bootstrap replicates. The package allows for calculating bootstrapped 95% confidence intervals for the estimated prevalence of debris. Combined with a Bayesian approach, the resampling simulations can be also used to define appropriate sample sizes to detect prevalence of plastics. The method has wide application, and can also be applied to estimate confidence intervals and define sample sizes for the prevalence of plastics ingested by any other organisms. The method is described in Tavares et al. (Submitted). |
Authors: | Davi Castro-Tavares [cre, aut], Esteban Acevedo-Trejos [aut], Jailson F. Moura [aut] |
Maintainer: | Davi Castro-Tavares <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.3 |
Built: | 2025-01-13 06:43:06 UTC |
Source: | CRAN |
A dataset containing absence and presence observations of plastic debris for the Caspian terns in the coast of Senegal.
ctern
ctern
A data frame with 529 rows and 8 variables:
species name, add more info
location, add more info
country, add more info
latitude, add more info
longitude, add more info
year, add more info
nest code, add more info
debris presence absence, add more info
Tavares et al. Submitted.
The package placer consist of two main functions to estimate the accumulation of plastic in bird's nest as a function of sample size, and a routine to plot the plastic prevalence probability, and their confidence intervals as a function of sample size.
The function plastic.prev.prob
calculates the plastic
prevalence probability for a given sample size based on presence and absence data
The function plastic.ci
estimates the 95% confidence intervals for a given
prevalence probability of plastic debris. In addition, the package placer includes a plotting
routine prevalence_plot
to show the estimated plastic prevalence probability and
their 95% confidence intervals as a function of sample size.
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)
plastic.ci(plastic_abs_pres, max_sample_size = 300, bs_rep = 1000, lower_ci = 0.025, upper_ci = 0.975)
plastic_abs_pres |
numeric vector, containing a binary values with 0 or no for absence of plastic, and 1 or yes for presence of plastic. |
max_sample_size |
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. |
bs_rep |
integer, specifying the number of bootstrap replications. By default 1000 replications. |
lower_ci |
numeric, specifying lower confidence interval. By default 2.5%, based on Efron and Tibshirani (1993) |
upper_ci |
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.
The confidence intervals are calculated in a sequence of varying sample sizes, i.e. 1,2,3...,n and the function can be also used for defining sample sizes that would provide 95% CIs with the desired accuracy.
Efron, B., & Tibshirani, R. (1993). An introduction to the Bootstrap. Boca Raton: Chapman & Hall.
plastic.prev.prob
, prevalence_plot
plastic.ci(rbinom(1000,1,0.5), 30, 100)
plastic.ci(rbinom(1000,1,0.5), 30, 100)
plastic.prev.prob
estimates the prevalence probability of plastic
from a randomly selected sample of absence/presence observations of plastic
debris.
plastic.prev.prob(plastic_abs_pres, num_sample)
plastic.prev.prob(plastic_abs_pres, num_sample)
plastic_abs_pres |
numeric vector, containing a binary values with 0 or 'no' for absence of plastic, and 1 or 'yes' for presence of plastic. |
num_sample |
integer value, specifying the number of samples to randomly draw from the observations. |
Prevalence probability of plastic debris in a given sample size.
plastic.prev.prob(rbinom(1000,1,0.5), 1) plastic.prev.prob(rbinom(1000,1,0.5), 10)
plastic.prev.prob(rbinom(1000,1,0.5), 1) plastic.prev.prob(rbinom(1000,1,0.5), 10)
Plot to show the plastic prevalence probability in seabird's nests as a function of different sample sizes and their corresponding confidence intervals.
prevalence_plot(prev_prob_mat, sample_sizes, lower_ci, upper_ci, xlab = "Sample size", ylab = "Plastic prevalence probability", colobs = "grey", colci = "#64B5F6")
prevalence_plot(prev_prob_mat, sample_sizes, lower_ci, upper_ci, xlab = "Sample size", ylab = "Plastic prevalence probability", colobs = "grey", colci = "#64B5F6")
prev_prob_mat |
numeric matrix, containing plastic prevalence probability with dimensions (samples_size, bootstrap_replicates). |
sample_sizes |
numeric vector, containing sequence of sample size used to
estimate the confidence intervals |
lower_ci |
numeric vector, containing values for lower confidence interval
and with the same length as |
upper_ci |
numeric vector, containing values for upper confidence interval
and with the same length as |
xlab |
string, label of x axis. |
ylab |
string, label of y axis. |
colobs |
color of observations. |
colci |
color of confidence intervals. |
binomtest <- plastic.ci(rbinom(1000,1,0.5), 30, 100) prevalence_plot(binomtest$prevprob, binomtest$cidtf$N, binomtest$cidtf$lower_ci, binomtest$cidtf$upper_ci)
binomtest <- plastic.ci(rbinom(1000,1,0.5), 30, 100) prevalence_plot(binomtest$prevprob, binomtest$cidtf$N, binomtest$cidtf$lower_ci, binomtest$cidtf$upper_ci)