Skip to contents

Calculates confidence interval coverage and width. The function also calculates the associated Monte Carlo standard errors. The confidence interval percentage is based on how you calculated the lower and upper bounds.

Usage

calc_coverage(
  data,
  lower_bound,
  upper_bound,
  true_param,
  criteria = c("coverage", "width")
)

Arguments

data

data frame or tibble containing the simulation results.

lower_bound

Vector or name of column from data containing lower bounds of confidence intervals.

upper_bound

Vector or name of column from data containing upper bounds of confidence intervals.

true_param

Vector or name of column from data containing corresponding true parameters.

criteria

character or character vector indicating the performance criteria to be calculated.

Value

A tibble containing the number of simulation iterations, performance criteria estimate(s) and the associated MCSE.

Examples

calc_coverage(data = t_res, lower_bound = lower_bound,
              upper_bound = upper_bound, true_param = true_param)
#> # A tibble: 1 × 5
#>   K_coverage coverage coverage_mcse width width_mcse
#>        <int>    <dbl>         <dbl> <dbl>      <dbl>
#> 1       1000    0.951       0.00683 0.791    0.00179