Percentile bootstrap confidence interval for a statistic
Source:R/bootstrap_ci.R
sframe_bootstrap_ci.RdResamples x with replacement R times, applies FUN to each resample,
and returns the percentile interval of the resampled statistics together
with the observed value.
Usage
sframe_bootstrap_ci(
x,
FUN = stats::median,
R = 2000,
conf.level = 0.95,
seed = NULL
)Arguments
- x
A numeric vector.
- FUN
A function of one vector returning a single number. Defaults to
stats::median().- R
Integer. Number of bootstrap resamples. Defaults to 2000.
- conf.level
Confidence level. Defaults to 0.95.
- seed
Integer or NULL. When supplied, sets the random seed so the interval is reproducible.
Value
A named numeric vector: estimate, lower, upper, with
attributes resamples, valid_resamples and, when the interval is
withheld, reason. The bounds are NA when fewer than 90% of resamples
give a value, or when every resample gives the same value, since neither
leaves a sampling distribution to read. The bounds
are NA when x has fewer than 3 finite values.
See also
sframe_cohens_d_ci(), sframe_cramers_v_ci(), sframe_eta_sq_ci()
Other Confidence interval functions:
sframe_cohens_d_ci(),
sframe_cramers_v_ci(),
sframe_eta_sq_ci()