Simulate a derived ACS statistic.
Usage
acs_simulate_fn(
estimates,
moes,
fn,
cov = NULL,
n_sims = 1000,
dist = c("normal", "censored_normal"),
conf = 0.9,
summary = c("mean", "median", "ci"),
point = c("mean", "median")
)
Arguments
- estimates
Numeric estimates.
- moes
Numeric MOEs corresponding to estimates.
- fn
Function applied to each simulated row.
- cov
Optional covariance matrix on the standard-error scale.
- n_sims
Number of Monte Carlo simulations.
- dist
Distribution assumption: "normal" or "censored_normal". The
censored variant replaces below-zero draws with zero, matching the
convention used in Napierala & Denton (2017) for ACS counts.
- conf
Confidence level associated with input MOEs.
- summary
Summary to return: "mean", "median", or "ci".
- point
For summary = "ci", point estimate to report alongside the
percentile interval: "mean" (default) or "median".
Value
A data frame summarizing the simulated derived statistic.
Details
For summary = "ci", the returned interval is the central
conf-level percentile interval of the simulated derived values. The
reported estimate is the chosen point summary of those values.
Examples
set.seed(1)
acs_simulate_fn(c(100, 50), c(10, 5), fn = sum, n_sims = 500)
#> estimate se
#> 1 150.002 6.822565
set.seed(1)
acs_simulate_fn(c(100, 50), c(10, 5), fn = sum, n_sims = 500,
summary = "ci", conf = 0.90)
#> estimate lower upper
#> 1 150.002 138.8195 161.133