Skip to contents

Analyzes convergence in Monte Carlo simulations by computing statistical measures across iterations. Calculates both standardized and raw differences between consecutive iterations to evaluate stability and convergence.

Usage

mcmodule_converg(
  mcmodule,
  from_quantile = 0.95,
  to_quantile = 1,
  conv_threshold = NULL
)

Arguments

mcmodule

A Monte Carlo module object containing simulation results

from_quantile

Lower bound quantile for analysis (default: 0.95)

to_quantile

Upper bound quantile for analysis (default: 1)

conv_threshold

Optional custom convergence threshold for standardized differences

Value

A data frame with convergence statistics per node:

  • expression: Expression identifier

  • variate: Variate identifier

  • node: Node identifier

  • max_std_dif: Max of standardized differences

  • max_dif: Max of raw differences

  • conv_threshold: Convergence at custom threshold (TRUE/FALSE), if threshold provided

  • conv_01: Convergence at 1% std threshold (TRUE/FALSE)

  • conv_025: Convergence at 2.5% std threshold (TRUE/FALSE)

  • conv_05: Convergence at 5% std threshold (TRUE/FALSE)

Details

The function performs the following:

  • Calculates convergence statistics for specified quantile range

  • Generates diagnostic plots for standardized and raw differences

  • Provides detailed convergence summary including:

    • Total nodes analyzed

    • Number and percentage of nodes converged at different thresholds

    • Maximum/minimum deviations

    • List of non-converged nodes (if any)

Examples

if (FALSE) { # \dontrun{
results <- mcmodule_converg(mc_results)
results <- mcmodule_converg(mc_results, from_quantile = 0.90, conv_threshold = 0.01)
} # }