GenMonteCarloSamples: GenMonteCarloSamples

View source: R/GenMonteCarloSamples.R

GenMonteCarloSamplesR Documentation

GenMonteCarloSamples

Description

GenMonteCarloSamples returns a list of samples from executing the function with arguments

Usage

GenMonteCarloSamples(calc, calc_args, iterations = 100)

Arguments

calc

A function to sample

calc_args

A function to create arguments for the func being sampled

iterations

The number of samples to create

Value

samples The return values from the calc function

Examples


calc_estimate <- function(a, ef) {
  return(a * ef)
}
calc_args <- function() {
  area <- 10
  emission_factor <- rtriangle(
    n = 1, theta = ef_defor,
    lower = ef_defor_lci,
    upper = ef_defor_uci
  )
  return(list(area, emission_factor))
}
GenMonteCarloSamples(calc_estimate, calc_args, 1000) # returns object

micko920/MonteCarloUtils documentation built on Oct. 27, 2023, 8:23 p.m.