Print the summarized results of a Monte Carlo Simulation run by future_mc()
and summarized by summary.mc()
Usage
# S3 method for summary.mc
print(x, ...)
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
)
#> Running single test-iteration for each parameter combination...
#>
#> Test-run successfull: No errors occurred!
#> Running whole simulation: Overall 6 parameter combinations are simulated ...
#>
#> Simulation was successfull!
#> Running time: 00:00:00.983762
summary(test_mc)
#> Results for the output mean:
#> param=0, x1=1: 3.015575
#> param=0, x1=2: 4.003162
#> param=0.5, x1=1: 3.49393
#> param=0.5, x1=2: 4.480855
#> param=1, x1=1: 3.985815
#> param=1, x1=2: 4.994084
#>
#>
#> Results for the output var:
#> param=0, x1=1: 0.9968712
#> param=0, x1=2: 1.026523
#> param=0.5, x1=1: 0.9933278
#> param=0.5, x1=2: 0.9997529
#> param=1, x1=1: 0.9979682
#> param=1, x1=2: 1.005633
#>
#>