Distribution class constructors {BLCOP} | R Documentation |
Constructors for distribution and mvdistribution class objects
Description
These functions create objects of class distribution
and mvdistribution
Usage
mvdistribution(RName, ...)
distribution(RName, ...)
Arguments
RName |
A string holding the R suffix corresponding to the distribution, e.g. "pois" for the Poisson distribution |
... |
Additional parameters that parametrize the distribution |
Details
In general any distribution with a corresponding sampling function can be used. This function should
have the name given in RName
but preceded with an "r", e.g. rnorm
for the normal
distribution. When the constructors are called, they check that the given sampling function exists
and that it takes the arguments that were passed in the ...
.
Value
An object of class distribution
or mvdistribution
.
Author(s)
Francisco Gochez <fgochez@mango-solutions.com>
See Also
Examples
## Not run:
# create a uniform distribution object and sample from it
myUnif <- distribution("unif", min = -0.1, max = 0.1)
hist(sampleFrom(myUnif, 1000))
mvNormal <- mvdistribution("mnorm", mean = c(1, 5), varcov = diag(c(2, 0.1)))
x <- sampleFrom(mvNormal, 1000)
plot(x[,1] ~ x[,2])
## End(Not run)
[Package BLCOP version 0.3.3 Index]