View source: R/StableMonteCarloSamples.R
StableMonteCarloSamples | R Documentation |
StableMonteCarloSamples
returns a list of samples from executing the function
with arguments. This differs to the GenMonteCarloSamples by traking the
samples and stopping when a confidence interval from an estimate is reached.
StableMonteCarloSamples(
calc,
calc_args,
estimate,
tolerance = 10^(-min(round(log10(abs(estimate))), 2.1)),
confidence = 0.9,
start = 10,
limit = 1e+08,
rolling_window = 3,
debug = FALSE,
trace = FALSE
)
calc |
A function to sample |
calc_args |
A function to create arguments for the func being sampled |
iterations |
The number of samples to create |
In hindsite after writing this by experimentation with a logistics curve concept I realised that this could be done with a PID method.
samples The return values from the calc function
calc_estimate <- function(v, ef) {
return(v + 1)
}
calc_args <- function() {
return(list(10))
}
StableMonteCarloSamples(calc_estimate, calc_args, 11) # returns samples
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.