print.mc {tidyMC}R Documentation

Print the results of a Monte Carlo Simulation

Description

Print the results of a Monte Carlo Simulation run by future_mc()

Usage

## S3 method for class 'mc'
print(x, ...)

Arguments

x

An object of class mc.

...

ignored

Value

print shows a complete representation of the run Monte Carlo Simulation

Examples

test_func <- function(param = 0.1, n = 100, x1 = 1, x2 = 2){

  data <- rnorm(n, mean = param) + x1 + x2
  stat <- mean(data)
  stat_2 <- var(data)

  if (x2 == 5){
    stop("x2 can't be 5!")
  }

  return(list(mean = stat, var = stat_2))
}

param_list <- list(param = seq(from = 0, to = 1, by = 0.5),
                   x1 = 1:2)

set.seed(101)
test_mc <- future_mc(
  fun = test_func,
  repetitions = 1000,
  param_list = param_list,
  n = 10,
  x2 = 2
)

test_mc

[Package tidyMC version 1.0.0 Index]