| liesInSupport | R Documentation |
The function tests if x lies in the support of the
distribution object.
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)
object |
object of class |
x |
numeric vector or matrix |
checkFin |
logical: in case |
... |
used for specific arguments to particular methods. |
logical vector
We return a logical vector of the same length as x with TRUE
when x lies in the support of object.
As support we use the value of support(object), so this
is possibly cut to relevant quantile ranges.
In case checkFin is TRUE, in addition, we flag those coordinates
to TRUE where x < min(support(object)) if
is.na(object@.finSupport[1]) or object@.finSupport[1]==FALSE
or q.l(object)(0)==-Inf, and similarly, where
x > max(support(object)) if is.na(object@.finSupport[2])
or object@.finSupport[2]==FALSE or q.l(object)(1)==Inf.
In addition we flag those coordinates to TRUE where
q.l(object)(0)<=x<min(support(object)) if
object@.finSupport[1]==TRUE and, similarly, where
q.l(object)(1)>=x>max(support(object)) if
object@.finSupport[2]==TRUE.
Argument x is cast to vector and then the respective
liesInSupport method for vectors is called. The method throws an
arror when the dispatch mechanism does not find a suitable, applicable
respective vector-method.
We return a logical vector of the same length as x with TRUE
where q.l(object)(0)<=x<=q.l(object)(1) (and replace the boundary
values by q.l(object)(10*.Machine$double.eps) resp.
q.l(object)(1-10*.Machine$double.eps) once the return values
for 0 or 1 return are NaN.
We return a logical vector of the same length as x with TRUE
when x lies in the support of object.
As support we use the value of support(object), so this
is possibly cut to relevant quantile ranges.
In case checkFin is TRUE, 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 than Length(lattice(object))-1.
In addition, we flag those coordinates to TRUE where
x < min(support(object)) if
is.na(object@.finSupport[1]) or object@.finSupport[1]==FALSE,
and similarly, where x > max(support(object)) if
is.na(object@.finSupport[2])
or object@.finSupport[2]==FALSE.
We split up object into discrete and absolutely continuous
part and for each of them apply liesInSupport separately;
the two return values are combined by a coponentwise logical |.
We first cast object to UnivarLebDecDistribution
by flat.mix and then apply the respective method.
Matthias Kohl Matthias.Kohl@stamats.de and Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
Distribution-class
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.