boot_wmean_ci: Calculate weighted mean and bootstrapped confidence limits...

Description Usage Arguments Value Author(s) Examples

Description

Based on https://www.painblogr.org/2017-10-18-purrring-through-bootstraps by Peter Kamerman (@painblogR)

Usage

1
boot_wmean_ci(df, value, weight, reps, conf, ...)

Arguments

df

Data frame containing grouping, value, and weighting fields.

value

Value field for statistics.

weight

Weighting field.

reps

Number of bootstrapping repetitions. May need to increase if BCa error occurs.

conf

Confidence limits probability (e.g., 0.95).

...

One or more grouping columns.

Value

Data frame with weighted mean and confidence limits.

Author(s)

Alex M Trueman

Examples

1
2
3
4
5
6
7
df <- data.frame(
x = rlnorm(n = 100, meanlog = 1.5, sdlog = 1.1),
w = runif(n = 100, min = 0.1, max = 5),
d = sample(c("a", "b"), 100, replace = TRUE)
)

boot_wmean_ci(df, x, w, reps = 100, conf = 0.9, d)

truemoid/mstats documentation built on May 24, 2019, 7:17 a.m.