Learn R Programming

decisionSupport (version 1.114)

hist.mcSimulation: Plot Histogram of results of a Monte Carlo Simulation

Description

This function plots the histograms of the results of mcSimulation.

Usage

# S3 method for mcSimulation
hist(
  x,
  breaks = 100,
  col = NULL,
  xlab = NULL,
  main = paste("Histogram of ", xlab),
  ...,
  colorQuantile = c("GREY", "YELLOW", "ORANGE", "DARK GREEN", "ORANGE", "YELLOW", "GREY"),
  colorProbability = c(1, 0.95, 0.75, 0.55, 0.45, 0.25, 0.05),
  resultName = NULL
)

Value

an object of class "histogram". For details see

hist.

Arguments

x

An object of class mcSimulation.

breaks

one of:

  • a vector giving the breakpoints between histogram cells,

  • a function to compute the vector of breakpoints,

  • a single number giving the number of cells for the histogram,

  • a character string naming an algorithm to compute the number of cells (see ‘Details’),

  • a function to compute the number of cells.

In the last three cases the number is a suggestion only; as the breakpoints will be set to pretty values, the number is limited to 1e6 (with a warning if it was larger). If breaks is a function, the x vector is supplied to it as the only argument (and the number of breaks is only limited by the amount of available memory).

col

a colour to be used to fill the bars.

xlab

character: x label of the histogram. If it is not provided, i.e. equals NULL the name of the chosen variable by argument resultName is used.

main

character: main title of the histogram.

...

Further arguments to be passed to hist.

colorQuantile

character vector: encoding the colors of the quantiles defined in argument colorProbability.

colorProbability

numeric vector: defines the quantiles that shall be distinguished by the colors chosen in argument colorQuantile. Must be of the same length as colorQuantile.

resultName

character: indicating the name of the component of the simulation function (model_function) which results histogram shall be generated. If model_function is single valued, no name needs to be supplied. Otherwise, one valid name has to be specified. Defaults to NULL.

See Also

mcSimulation, hist. For a list of colors available in R see colors.