View source: R/distributions.R
rdistr.template | R Documentation |
Template function for writing SimCausal
custom distribution wrappers.
rdistr.template(n, arg1, arg2, ...)
n |
Sample size that needs to be generated |
arg1 |
Argument 2 |
arg2 |
Argument 1 |
... |
Additional optional parameters |
One of the named arguments must be 'n', this argument is passed on to the function automatically by
the package and is assigned to the number of samples that needs to be generated from this distribution.
Other arguments (in this example arg1 and arg2) must be declared by the user as
arguments inside the node() function that uses this distribution,
e.g., node("Node1"
, distr="distr.template"
, arg1 = ...
, arg2 = ...)
.
Both, arg1 and arg2, can be either numeric constants or formulas involving past node names.
The constants get passed on to the distribution function unchanged.
The formulas are evaluated inside the environment of the simulated data and are passed on to the
distribution functions as vectors.
The output of the distribution function is expected to be a vector of length n of the sampled covariates.
A vector of length n
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.