summarize_simulation_scenario: Wrapper function that computes all simulation metrics

View source: R/eval_metrics.R

summarize_simulation_scenarioR Documentation

Wrapper function that computes all simulation metrics

Description

This wrapper function is compatible with dplyr and can be called in a dplyr chain of arguments.

Usage

summarize_simulation_scenario(
  true_values,
  simulated_values,
  lower_cci,
  upper_cci,
  SE = NULL,
  compute_multimodal = FALSE
)

Arguments

true_values

vector of length n. Contains true population values.

simulated_values

vector of length n. Contains simulated values.

lower_cci

vector of length n. Upper 95% CCI.

SE

vector of length n. Standard Error of the posterior distribution.

compute_multimodal

boolean. If TRUE, this function will compute a test on the simulated parameter values to check if the distribution of parameter estimates is multimodal. See modetest.

Value

data frame containing:

bias

percent bias of the simulation scenario, computed as a percentage relative to the true value.

bias_mcmc_se

MCMC standard error of bias estimate, computed as a percentage relative to the bias estimate.

empirical_se

empirical standard error computed from the simulated values.

empirical_se_mcmc_se

MCMC standard error of the empirical SE.

modSE

model standard error computed from the simulated values.

modSE_mcmc_se

MCMC standard error of the model SE.

MSE

Mean-Squared Error of the simulated values.

MSE_mcmc_se

MCMC standard error of the simulated values.

coverage

Coverage given the 95% CCI.

coverage_mcmc_se

MCMC standard error of coverage.

bias_corr_coverage

Bias-adjusted coverage. Instead of using the true population value, use the mean of the simulated values. Useful to check whether poor coverage is the result of bias. See 'See also' for reference.

bias_corr_coverage_mcmc_se

MCMC standard error of bias-adjusted coverage.

multimodal

p-value of the modetest used to check for multimodal distributions.

See Also

Morris, Tim P., Ian R. White, and Michael J. Crowther. "Using simulation studies to evaluate statistical methods." Statistics in medicine 38.11 (2019): 2074-2102.

Examples

## Not run: 
tst <- data %>%
   group_by(scenario_id) %>%
   # This is how you use the function
   do(summarize_simulation_metrics(.$true_values, .$simulated_values
                                   .$lower_cci, .$upper_cci, FALSE))

## End(Not run)


smildiner/simHMM documentation built on July 17, 2022, 2 p.m.