mcr: monte carlo simulation using mc2d

View source: R/mcr.R

mcrR Documentation

monte carlo simulation using mc2d

Description

a wrapper for mc2d

Usage

mcr(myfilename = NULL, mycorrmatfilename = NULL, myseed = 12345L, nsims = 1000)

Arguments

myfilename

is the name of the main input Excel file

mycorrmatfilename

is the name of an input Excel file containing a desired correlation matrix (this is optional).

myseed

the random number seed to be used

nsims

the desired number of Monte Carlo simulations

Details

The input spreadsheet should have only one sheet with the following columns and one row for each variable to be simulated:

  • Index (numeric)

  • Variable (character)

  • codename (character)

  • Base (numeric)

  • Minimum (numeric)

  • Mode (numeric)

  • Maximum (numeric)

  • Distribution (character) - Uniform, Triangular, or PERT.

  • Shape (numeric) - only needed if distribution is "PERT"

If specified, the file "mycorrmatfilename" with the correlation matrix should have only one sheet and the variables should be named "V1", "V2", ..., "VN" for N variables.

Examples

myinputfile <- system.file("extdata", "risk_variable_distributions.xlsx", package = "humblr")
mytest1 <- mcr(myinputfile, nsims = 1000, myseed = 12345L)
mytest1

mycorrmatfile <- system.file("extdata", "correlation_matrix.xlsx", package = "humblr")
mytest2 <- mcr(myinputfile, mycorrmatfilename = mycorrmatfile, nsims = 1000, myseed = 12345L)
mytest2


alexmitrani/humblr documentation built on April 4, 2022, 8:29 a.m.