Description Usage Arguments Details Objects from the Class Note Author(s) See Also Examples
View source: R/LatticeDistribution.R
The LatticeDistribution
class is the motherclass of the
classes Binom
, Dirac
, Geom
, Hyper
, Nbinom
and
Poisson
. It formalizes a distribution on a regular affine
linear lattice.
1 2 3 4  LatticeDistribution(lattice = NULL, supp = NULL, prob = NULL,
.withArith = FALSE, .withSim = FALSE,
DiscreteDistribution = NULL, check = TRUE,
Symmetry = NoSymmetry())

DiscreteDistribution 
an object of class 
lattice 
lattice (of class 
supp 
numeric vector which forms the support of the discrete distribution. 
prob 
vector of probability weights for the
elements of 
.withArith 
normally not set by the user, but if determining the entries

.withSim 
normally not set by the user, but if determining the entries

check 
logical: if 
Symmetry 
you may help R in calculations if you tell it whether
the distribution is nonsymmetric (default) or symmetric with respect
to a center; in this case use 
Typical usages are
1 2 3 4 5 6  LatticeDistribution(DiscreteDistribution)
LatticeDistribution(lattice, DiscreteDistribution)
LatticeDistribution(lattice, supp, prob, .withArith, .withSim, check = FALSE)
LatticeDistribution(lattice, supp, prob)
LatticeDistribution(supp)

For the generating function LatticeDistribution()
, the arguments
are processed in the following order:
Arguments .withSim
and .withArith
are used in any case.
If there is an argument DiscreteDistribution
(of the respective class),
all its slots (except for .withSim
and .withArith
)
will be used for filling the slots of the object of class
LatticeDistribution()
/AffLinLatticeDistribution()
.
If in addition, there is an argument lattice
of class Lattice
,
it will be checked for consistency
with argument DiscreteDistribution
and if oK will be used for slot
lattice of the object of class
LatticeDistribution()
/AffLinLatticeDistribution()
. In case
there is no lattice
argument, slot lattice
will be constructed
from slot support
from argument DiscreteDistribution
.
If there is no argument DiscreteDistribution
, but there are arguments
supp
and lattice
(the latter of class Lattice
) then
these are checked for consistency and if oK, generating function
DiscreteDistribution()
is called with arguments supp
,
prob
, .withArith
, and .withSim
to produce an object
of class DiscreteDistribution
the slots of which will be used for the
filling the slots of the object of class
LatticeDistribution()
/AffLinLatticeDistribution()
.
If in this case, argument prob
is not given explicitely, all elements
in supp
are equally weighted.
If there is no argument DiscreteDistribution
, but there is an argument
lattice
of class Lattice
(but no argument slot
) then
if Length(lattice)
is finite, a corresponding support vector supp
is generated from argument lattice
and generating function
DiscreteDistribution()
is called with arguments supp
,
prob
, .withArith
, and .withSim
to produce an object
of class DiscreteDistribution
the slots of which will be used for the
filling the slots of the object of class LatticeDistribution()
.
If in the same situation Length(lattice)
is not finite, a finite length
for the support vector is extracted from argument prob
and after
generating supp
one procedes as in the finite Length(lattice)
case.
If there is no argument DiscreteDistribution
and no argument
lattice
of class Lattice
but an argument supp
then
it will be checked if supp
makes for a lattice, and if so,
DiscreteDistribution()
is called with arguments supp
,
prob
, .withArith
, and .withSim
to produce an object
of class DiscreteDistribution
the slots of which will be used for the
filling the slots of the object of class LatticeDistribution()
. The
corresponding lattice
slot will be filled with information from
argument supp
.
The price for this flexibility of arguments, LatticeDistribution()
may
be called with, is that you should call LatticeDistribution()
with
named arguments only.
Note that internally we suppress lattice points from the support where
the probability is 0.
The usual way to generate objects of class LatticeDistribution
is to call
the generating function LatticeDistribution()
(see details).
Somewhat more flexible, but also proner to inconsistencies is a call to
new("LatticeDistribution")
, where you may explicitly specify random
number generator, (counting) density, cumulative distribution and quantile
functions. For conveniance, in this call to new("LatticeDistribution")
,
an additional possibility is to only specify the random number generator. The
function RtoDPQ.d
then approximates the three remaining slots d
,
p
and q
by random sampling.
Working with a computer, we use a finite interval as support which
carries at least mass 1getdistrOption("TruncQuantile")
.
Peter Ruckdeschel [email protected]
Parameterclass
Latticeclass
LatticeDistributionclass
Realsclass
RtoDPQ.d
1 2 3  LatticeDistribution(DiscreteDistribution = DiscreteDistribution(supp =
c(4,3,2), prob=c(0.3,0.1,0.6)))
LatticeDistribution(supp = c(4,3,2))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.