This function calculates bootstrap confidence intervals for the population median absolute deviation, see stats::mad
for more information on this measure of scale.
ci_mad(
x,
probs = c(0.025, 0.975),
constant = 1.4826,
type = "bootstrap",
boot_type = c("bca", "perc", "norm", "basic"),
R = 9999,
seed = NULL,
...
)
A numeric vector.
Error probabilites. The default c(0.025, 0.975) gives a symmetric 95% confidence interval.
Scaling factor applied. The default (1.4826) ensures that the MAD equals the standard deviation for a theoretical normal distribution.
Type of confidence interval. Currently not used as the only type is "bootstrap".
Type of bootstrap confidence interval c("bca", "perc", "norm", "basic").
The number of bootstrap resamples.
An integer random seed.
Further arguments passed to boot::boot
.
A list with class cint
containing these components:
parameter
: The parameter in question.
interval
: The confidence interval for the parameter.
estimate
: The estimate for the parameter.
probs
: A vector of error probabilities.
type
: The type of the interval.
info
: An additional description text for the interval.
Bootstrap confidence intervals are calculated by the package "boot", see references. The default bootstrap type is "bca" (bias-corrected accelerated) as it enjoys the property of being second order accurate as well as transformation respecting (see Efron, p. 188).
Efron, B. and Tibshirani R. J. (1994). An Introduction to the Bootstrap. Chapman & Hall/CRC.
Canty, A and Ripley B. (2019). boot: Bootstrap R (S-Plus) Functions.
# NOT RUN {
set.seed(1)
x <- rnorm(100)
ci_mad(x, R = 999)
# }
Run the code above in your browser using DataLab