Description Usage Arguments Value Examples

`add_simulation`

creates or augments a list of simulated distributions of summary statistics, and formats the simulation results appropriately for further use. The user does not have to think about this return format. Instead, s-he only has to think about the very simple return format of the function given as its `Simulate`

argument. Alternatively, if the simulation function cannot be called directly by the R code, simulated distributions can be added easily using the `newsimuls`

argument, again using a simple format (see `onedistrib`

in the Examples). `add_reftable`

is a wrapper for `add_simulation`

, enforcing `nRealizations=1`

.

1 2 3 4 | ```
add_simulation(simulations=NULL, Simulate, par.grid=NULL,
nRealizations = NULL,
newsimuls = NULL, verbose = interactive())
add_reftable(...)
``` |

`simulations` |
A list of simulations |

`Simulate` |
The name (as a character string) of the function used to generate empirical distributions of summary statistics. The function must have a single vector as argument, matching rows of |

`par.grid` |
A data frame which each line matches the single vector argument of |

`nRealizations` |
The number of simulated samples of summary statistics, for each empirical distribution (each row of |

`newsimuls` |
If the function used to generate empirical distributions cannot be called by R, then |

`verbose` |
Whether to print some information or not |

`...` |
Arguments passed to |

If only one realization is computed for each (vector-valued) parameter, a data.frame is returned.
Otherwise, the return value is an objet of class `EDFlist`

, which is a list of matrices-with-attribute. Each matrix contains a simulated distribution of summary statistics for given parameters, and the `"par"`

attribute is a vector of parameters. If `Simulate`

is used, this must give the full parameters required for a call of the simulation function; otherwise it must at least include all variable parameters in this **or later** simulations to be appended to the simulation list.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# example of building a list of simulations from scratch:
myrnorm <- function(mu,s2,sample.size) {
s <- rnorm(n=sample.size,mean=mu,sd=sqrt(s2))
return(c(mean=mean(s),var=var(s)))
}
set.seed(123)
onedistrib <- t(replicate(100,myrnorm(1,1,10))) # toy example of simulated distribution
attr(onedistrib,"par") <- c(mu=1,sigma=1,sample.size=10) ## important!
add_simulation(NULL, Simulate="myrnorm",
newsimuls=list("example"=onedistrib))
## see main documentation page for the package for other typical usage
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.