| simCalibrationSim | R Documentation |
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
)
nsim |
Integer, replicates per (setting, |
n.vec |
Integer vector of sample sizes.
Default |
alpha |
Numeric, nominal CI level. Default 0.05. |
output.dir |
Character, directory for raw per-cell RDS files.
Default |
fixed.knots |
Logical. Fix spline knots at full-dataset quantiles.
Default |
deriv_method |
Character, type of derivative being evaluated. Package now only includes "extended" in resi implementation. |
mc.cores.reps |
Integer, cores for within-cell parallelism. Default 1. |
Invisibly returns the combined metrics data.frame.
insurancePlasmodeSim, simCompareMethodsFigures
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.