| insurancePlasmodeSim | R Documentation |
Runs a plasmode simulation study using the insurance dataset to
evaluate RESI confidence interval performance. In each replicate, n
observations are resampled with replacement from the full insurance dataset
(N = 1338). The RESI point estimates from resi_pe applied
to the full dataset are treated as the true parameter values for computing bias,
MSE, CI coverage, and CI width.
insurancePlasmodeSim(
nsim = 1000L,
n.vec = c(50, 100, 200, 500, 1000, 2000, 5000),
nboot = 500L,
alpha = 0.05,
ci.method = c("boot", "normal", "qf", "cf"),
output.dir = NULL,
fixed.knots = FALSE,
mc.cores.settings = 1L,
mc.cores.reps = 1L
)
nsim |
Integer, number of simulation replicates per (setting, |
n.vec |
Integer vector of sample sizes. Default
|
nboot |
Integer, bootstrap replicates per internal |
alpha |
Numeric, CI significance level. Default 0.05. |
ci.method |
Character, CI method passed to |
output.dir |
Character, path to the directory where all results are saved.
Created if it does not exist. Defaults to |
fixed.knots |
Logical. If |
mc.cores.settings |
Integer, cores for the outer
|
mc.cores.reps |
Integer, cores for the inner |
Two models are evaluated:
lm: log10(charges) ~ ns(age, df=3) * sex + bmi + smoker + region
glm: I(charges > 10000) ~ ns(age, df=3) * sex + bmi + smoker + region
with family = binomial()
Each model is evaluated under both parametric (vcovfunc = stats::vcov) and
robust (vcovfunc = sandwich::vcovHC) variance settings, yielding four
simulation conditions.
Parallelization is via mclapply, which uses forking and is
not supported on Windows (falls back to sequential evaluation on Windows).
Invisibly returns the summary metrics data.frame. Side effects:
output.dir/sim_raw/<setting>_n<n>.rds: list of per-replicate
anova and coefficients tables.
output.dir/summary_table.rds: combined metrics table with columns
model, vcov, n, n_success, table, term, bias, mse, coverage, width.
simFigures, simCompareMethodsFigures,
resi, resi_pe
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.