join_metrics {simMetric}R Documentation

Join metrics

Description

Calculate and join selected evaluation metrics given a data.frame of simulation study results Provides a fast way to add multiple metrics and their Monte Carlo standard errors.

Usage

join_metrics(
  data,
  id_cols,
  metrics = c("coverage", "mse", "modSE"),
  true_value = NULL,
  ll_col = NULL,
  ul_col = NULL,
  estimates_col = NULL,
  se_col = NULL,
  p_col = NULL,
  alpha = 0.05
)

Arguments

data

A data.frame that contains results from simulation study and the necessary columns to compute metrics.

id_cols

Column name(s) on which to group data and calculate metrics.

metrics

A vector of metrics to be calculated.

true_value

The true parameter to be estimated.

ll_col

Name of the column that contains the lower limit of the confidence intervals. (Required for calculating coverage.)

ul_col

Name of the column that contains the upper limit of the confidence intervals. (Required for calculating coverage.)

estimates_col

Name of the column that contains the parameter estimates. (Required for calculating bias, empSE, and mse.)

se_col

Name of the column that contains the standard errors. (Required for calculating modSE.)

p_col

Name of the column that contains the p-values. (Required for calculating rejection.)

alpha

The nominal significance level specified. (Required for calculating rejection.)

Value

data.frame containing metrics and id_cols

Examples

simulations_df <- data.frame(
  idx=rep(1:10, 100),
  idx2=sample(c("a", "b"), size=1000, replace=TRUE),
  p_value=runif(1000),
  est=rnorm(n=1000),
  conf.ll= rnorm(n=1000, mean=-20),
  conf.ul= rnorm(n=1000, mean=20)
)
res <- join_metrics(
  data=simulations_df,
  id_cols=c("idx", "idx2"),
  metrics=c("rejection", "coverage", "mse"),
  true_value=0,
  ll_col="conf.ll",
  ul_col="conf.ul",
  estimates_col="est",
  p_col="p_value",
)

[Package simMetric version 0.1.1 Index]