liesInSupport {distr} | R Documentation |
Generic Function for Testing the Support of a Distribution
Description
The function tests if x
lies in the support of the
distribution object
.
Usage
liesInSupport(object, x, ...)
## S4 method for signature 'UnivarLebDecDistribution,numeric'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'UnivarMixingDistribution,numeric'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'LatticeDistribution,numeric'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'DiscreteDistribution,numeric'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'AbscontDistribution,numeric'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'Distribution,matrix'
liesInSupport(object,x, checkFin = FALSE)
## S4 method for signature 'ExpOrGammaOrChisq,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Lnorm,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Fd,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Norm,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'DExp,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Cauchy,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Td,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Logis,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Weibull,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Unif,numeric'
liesInSupport(object,x, checkFin = TRUE)
## S4 method for signature 'Beta,numeric'
liesInSupport(object,x, checkFin = TRUE)
Arguments
object |
object of class |
x |
numeric vector or matrix |
checkFin |
logical: in case |
... |
used for specific arguments to particular methods. |
Value
logical vector
Methods
- object = "DiscreteDistribution", x = "numeric":
-
We return a logical vector of the same length as
x
withTRUE
whenx
lies in the support ofobject
. As support we use the value ofsupport(object)
, so this is possibly cut to relevant quantile ranges. In casecheckFin
isTRUE
, in addition, we flag those coordinates toTRUE
wherex < min(support(object))
ifis.na(object@.finSupport[1])
orobject@.finSupport[1]==FALSE
orq.l(object)(0)==-Inf
, and similarly, wherex > max(support(object))
ifis.na(object@.finSupport[2])
orobject@.finSupport[2]==FALSE
orq.l(object)(1)==Inf
. In addition we flag those coordinates toTRUE
whereq.l(object)(0)<=x<min(support(object))
ifobject@.finSupport[1]==TRUE
and, similarly, whereq.l(object)(1)>=x>max(support(object))
ifobject@.finSupport[2]==TRUE
. - object = "Distribution", x = "matrix":
-
Argument
x
is cast to vector and then the respectiveliesInSupport
method for vectors is called. The method throws an arror when the dispatch mechanism does not find a suitable, applicable respective vector-method. - object = "AbscontDistribution", x = "numeric":
-
We return a logical vector of the same length as
x
withTRUE
whereq.l(object)(0)<=x<=q.l(object)(1)
(and replace the boundary values byq.l(object)(10*.Machine$double.eps)
resp.q.l(object)(1-10*.Machine$double.eps)
once the return values for0
or1
return areNaN
. - object = "LatticeDistribution", x = "numeric":
-
We return a logical vector of the same length as
x
withTRUE
whenx
lies in the support ofobject
. As support we use the value ofsupport(object)
, so this is possibly cut to relevant quantile ranges. In casecheckFin
isTRUE
, we instead use the lattice information: We check whether all values(x-pivot(lattice(object))/width(lattice(object))
are non-negative integers and are non larger thanLength(lattice(object))-1
. In addition, we flag those coordinates toTRUE
wherex < min(support(object))
ifis.na(object@.finSupport[1])
orobject@.finSupport[1]==FALSE
, and similarly, wherex > max(support(object))
ifis.na(object@.finSupport[2])
orobject@.finSupport[2]==FALSE
. - object = "UnivarLebDecDistribution", x = "numeric":
-
We split up
object
into discrete and absolutely continuous part and for each of them applyliesInSupport
separately; the two return values are combined by a coponentwise logical|
. - object = "UnivarMixingDistribution", x = "numeric":
-
We first cast
object
toUnivarLebDecDistribution
byflat.mix
and then apply the respective method.
Author(s)
Matthias Kohl Matthias.Kohl@stamats.de and Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
See Also
Examples
liesInSupport(Exp(1), rnorm(10))
# note
x <- rpois(10, lambda = 10)
liesInSupport(Pois(1), x)
# better
liesInSupport(Pois(1), x, checkFin = TRUE)
liesInSupport(Pois(1), 1000*x, checkFin = TRUE)
liesInSupport(-10*Pois(1), -10*x+1, checkFin = TRUE)
xs = c(1000*x,runif(10))
D <- UnivarMixingDistribution(Pois(1),Unif())
liesInSupport(D, xs)