Runs Monte Carlo simulations using the bias-corrected crosswise model and creates a caterpillar plot showing sorted point estimates with bootstrap confidence intervals, replicating Panel C of Figure C7 in Atsusaka and Stevenson (2023).
sim_estimates(
N.sim = 100,
sample,
prevalence,
p,
p.prime,
gamma,
direct,
txcol = "dimgray",
sim.results = NULL,
verbose = TRUE
)
sim.estimates(...)Integer. Number of Monte Carlo simulations. Default is 100.
Integer. Sample size per simulation.
Numeric. True prevalence rate of the sensitive attribute.
Numeric. Randomization probability for the sensitive question.
Numeric. Randomization probability for the anchor question.
Numeric. Proportion of attentive respondents (between 0 and 1).
Numeric. Direct questioning estimate for comparison.
Character. Color for annotation text. Default: "dimgray".
Optional list. Pre-computed output from sim_cwdata.
If NULL (default), the simulation is run internally.
Logical. Passed to sim_cwdata() when a new simulation is
needed. If TRUE (the default), a progress bar is displayed.
Arguments passed to sim_estimates().
Invisibly returns the simulation results list from sim_cwdata,
containing BiasCorrectEst, BiasCorrectLow,
BiasCorrectHigh, and summary Results.
The plot displays:
Sorted bias-corrected point estimates as filled circles
Bootstrap 95% confidence intervals as vertical line segments
A horizontal reference line at 0
A horizontal reference line at the true prevalence prevalence (red)
Estimates are sorted in ascending order, creating a characteristic "fan" shape that reveals the distribution of estimates across simulations.
Text annotation positions are calibrated to N.sim = 100 and scale
proportionally for other values.
If sim.results is supplied, all simulation parameters (N.sim,
sample, p, p.prime, gamma, direct) are
still used for the annotations, but no new simulation is run.
Atsusaka and Stevenson (2023). Figure C7, Panel C. doi:10.1017/pan.2021.43 .
sim_cwdata for the underlying simulation function
if (FALSE) { # \dontrun{
# Replicate Panel C of Figure C7
sim_estimates(
N.sim = 100,
sample = 1000,
prevalence = 0.1,
p = 0.1,
p.prime = 0.1,
gamma = 0.8,
direct = 0.1
)
# Re-use pre-computed simulation results
res <- sim_cwdata(N.sim = 100, sample = 1000, prevalence = 0.1,
p = 0.1, p.prime = 0.1, gamma = 0.8, direct = 0.1)
sim_estimates(sample = 1000, prevalence = 0.1, p = 0.1, p.prime = 0.1,
gamma = 0.8, direct = 0.1, sim.results = res)
} # }