unuran.discr.new {Runuran} | R Documentation |
Create a new UNU.RAN object for a discrete univariate distribution. The interface might be changed in future releases. Do not use unnamed arguments!
[Advanced] – Discrete Distribution.
unuran.discr.new(pv=NULL, pmf=NULL, lb=NA, ub=NA, mode=NA, sum=NA, name=NA)
pv |
probability vector. (numeric vector) |
pmf |
probability mass function. (R function) |
mode |
mode of distribution. (numeric, integer) |
lb |
lower bound of domain;
use -Inf if unbounded from left. (numeric, integer) |
ub |
upper bound of domain;
use Inf if unbounded from right;
when pmf is not given, the default ub=Inf is
used. (numeric, integer) |
sum |
sum over pv / pmf ; used for computing
normalization constants if required. (numeric) |
name |
name of distribution. (string) |
Creates an instance of class unuran.discr
.
For more details see also unuran.new
.
The user is responsible that the given informations are consistent. It depends on the chosen method which information must be given / are used.
unuran.discr.new(...)
is an alias for
new("unuran.discr", ...)
.
Josef Leydold and Wolfgang H"ormann unuran@statmath.wu-wien.ac.at.
W. H"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg.
unuran.discr
, unuran.new
,
unuran
.
## Create a distribution object with given PV and mode mypv <- dbinom(0:100,100,0.3) distr <- new("unuran.discr", pv=mypv, lb=0, mode=30) ## Create discrete distribution with given probability vector ## (the PV need not be normalized) pv <- c(1.,2.,1.5,0.,3.,1.2) dpv <- new("unuran.discr", pv=pv, lb=1) ## Create discrete distribution with given PMF pmf <- function(x) dbinom(x,100,0.3) dpmf <- new("unuran.discr", pmf=pmf, lb=0, ub=100)