Runs a plasmode simulation to verify that the asymptotic normal CI machinery is correctly calibrated for all four model settings (lm/glm x parametric/robust). For each (setting, sample size) cell the function checks:
Bias(theta): \(\hat\theta \to \theta_{\rm true}\) --
raw coefficients (and \(\phi = \hat\sigma^2\) for lm) converge
to the full-dataset values.
vcov check A (estimator consistency): \(n \cdot \bar V_{\rm analytic} / (n_{\rm full} \cdot V_{\rm true}) \to 1\).
vcov check B (calibration): \(n \cdot \widehat{\rm Var}(\hat\beta) / (n_{\rm full} \cdot V_{\rm true}) \to 1\).
Bias(R): RESI point estimates converge to the full-dataset values.
sigma2S check A (estimator consistency): \(\bar{\hat\sigma}^2_S / \sigma^2_{S,\rm true} \to 1\).
sigma2S check B (CI calibration): \(n \cdot \widehat{\rm Var}(\hat R) / \sigma^2_{S,\rm true} \to 1\).
True values are taken from the full insurance dataset using the
same definitions as insurancePlasmodeSim. \(\sigma^2_S\) is
extracted from the asymptotic-normal CI half-width:
\(\hat\sigma^2_S = n \cdot ({\rm hw}/z_{\alpha/2})^2\).
simCalibrationSim(
nsim = 500L,
n.vec = c(100L, 200L, 500L, 1000L, 2000L, 5000L),
alpha = 0.05,
output.dir = "resiCalibrationSim",
fixed.knots = FALSE,
deriv_method = c("corrected", "original", "population", "population2", "zeroB",
"zero_phi_cross", "extended"),
mc.cores.reps = 1L
)Invisibly returns the combined metrics data.frame.
Integer, replicates per (setting, \(n\)) cell. Default 500.
Integer vector of sample sizes.
Default c(100, 200, 500, 1000, 2000, 5000).
Numeric, nominal CI level. Default 0.05.
Character, directory for raw per-cell RDS files.
Default "resiCalibrationSim".
Logical. Fix spline knots at full-dataset quantiles.
Default FALSE.
Character, type of derivative being evaluated. Package now only includes "extended" in resi implementation.
Integer, cores for within-cell parallelism. Default 1.
insurancePlasmodeSim, simCompareMethodsFigures