
Asymptotic Calibration Check for RESI Variance Estimates
Source:R/simulations.R
simCalibrationSim.RdRuns 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\).
Usage
simCalibrationSim(
nsim = 500L,
n.vec = c(100L, 200L, 500L, 1000L, 2000L, 5000L),
alpha = 0.05,
output.dir = "resiCalibrationSim",
fixed.knots = FALSE,
mc.cores.reps = 1L
)Arguments
- nsim
Integer, replicates per (setting, \(n\)) cell. Default 500.
- n.vec
Integer vector of sample sizes. Default
c(100, 200, 500, 1000, 2000, 5000).- alpha
Numeric, nominal CI level. Default 0.05.
- output.dir
Character, directory for raw per-cell RDS files. Default
"resiCalibrationSim".- fixed.knots
Logical. Fix spline knots at full-dataset quantiles. Default
FALSE.- mc.cores.reps
Integer, cores for within-cell parallelism. Default 1.