DISTRIBUTION is a kind of abstract class (or interface) that the specific constructors should implement.
Details
It contains 4 fields
- distribution
A character with the name of the distribution implemented
- seed
A numerical that is used for
detailsto produce reproducible details of the distribution- oval
Observed value. Is the value expected. It is used as a number for the mathematical operations of the distributions as if they were a simple scalar
- rfunc
A function that generate random numbers from the distribution. Its only parameter
nis the number of draws of the distribution. It returns a matrix with as many rows as n, and as many columns as the dimensions of the distributions
The DISTRIBUTION objects could support multidimensional distributions
for example DIRICHLET. The names of the dimensions
should coincides with the names of the oval vector.
If only one dimension, the default name is rvar.
It is expected that the rfunc is included in the creation of new
distributions by convolution so the environment should be carefully controlled
to avoid reference leaking that is possible within the R language. For that
reason, rfunc should be created within a restrict_environment
function
Once the object is instanced, the fields are immutable and should not be
changed. If the seed needs to be modified, a new object can be created using
the set_seed function
Objects are defined for the following distributions
