Given a matrix of simulated coefficient estimates and the true coefficient vector, compute per‐variable summary statistics: the empirical mean and standard deviation of the estimates, alongside the true value.
Value
A data.frame with columns:
trueThe true coefficient values, from
true_theta.meanRow‐wise mean of
sims_coef, the average estimated coefficient.ssdRow‐wise standard deviation of
sims_coef, the empirical sampling variability.
Examples
# Suppose we ran 100 simulations for 3 predictors
set.seed(42)
true_theta <- c(1.5, 0, -2)
sims_coef <- matrix(rnorm(3 * 100, mean = rep(true_theta, each = 100), sd = 0.3),
nrow = 3, byrow = TRUE)
summarize_coef(sims_coef, true_theta)
#> true mean ssd
#> 1 1.5 1.51 0.31
#> 2 0.0 -0.03 0.27
#> 3 -2.0 -2.00 0.31