| Title: | Extensions of Package 'distr' |
|---|---|
| Description: | Extends package 'distr' by functionals, distances, and conditional distributions. |
| Authors: | Matthias Kohl [cre, cph], Peter Ruckdeschel [aut, cph] |
| Maintainer: | Matthias Kohl <[email protected]> |
| License: | LGPL-3 |
| Version: | 2.9.6 |
| Built: | 2026-05-07 07:53:05 UTC |
| Source: | https://github.com/r-forge/distr |
distrEx provides some extensions of package distr:
expectations in the form
E(X) for the expectation of a
distribution object X
E(X,f) for the expectation of f(X)
where X is some distribution object and
f some function in X
further functionals: var, sd, IQR, mad, median, skewness, kurtosis
truncated moments,
distances between distributions (Hellinger, Cramer von Mises, Kolmogorov, total variation, "convex contamination")
lists of distributions,
conditional distributions in factorized form
conditional expectations in factorized form
Support for extreme value distributions has moved to package RobExtremes
| Package: | distrEx |
| Version: | 2.9.6 |
| Date: | 2025-01-11 |
| Depends: | R(>= 3.4), methods, distr(>= 2.8.0) |
| Imports: | startupmsg(>= 1.0.0), utils, stats |
| Suggests: | tcltk |
| LazyLoad: | yes |
| License: | LGPL-3 |
| URL: | https://distr.r-forge.r-project.org/ |
| VCS/SVNRevision: | 1482 |
Distribution Classes "Distribution" (from distr) |>"UnivariateDistribution" (from distr) |>|>"AbscontDistribution" (from distr) |>|>|>"Gumbel" (moved to package 'RobExtremes') |>|>|>"Pareto" (moved to package 'RobExtremes') |>|>|>"GPareto" (moved to package 'RobExtremes') |>"MultivariateDistribution" |>|>"DiscreteMVDistribution-class" |>"UnivariateCondDistribution" |>|>"AbscontCondDistribution" |>|>|>"PrognCondDistribution" |>|>"DiscreteCondDistribution" Condition Classes "Condition" |>"EuclCondition" |>"PrognCondition" Parameter Classes "OptionalParameter" (from distr) |>"Parameter" (from distr) |>|>"LMParameter" |>|>"GumbelParameter" |>|>"ParetoParameter"
Integration:
GLIntegrate Gauss-Legendre quadrature
distrExIntegrate Integration of one-dimensional functions
Options:
distrExOptions Function to change the global variables of the
package 'distrEx'
Standardization:
make01 Centering and standardization of univariate
distributions
Distribution Classes
ConvexContamination Generic function for generating convex
contaminations
DiscreteMVDistribution
Generating function for
DiscreteMVDistribution-class
Gumbel Generating function for Gumbel-class
LMCondDistribution Generating function for the conditional
distribution of a linear regression model.
Condition Classes
EuclCondition Generating function for EuclCondition-class
Parameter Classes
LMParameter Generating function for LMParameter-class
Distances:
ContaminationSize Generic function for the computation of the
convex contamination (Pseudo-)distance of two
distributions
HellingerDist Generic function for the computation of the
Hellinger distance of two distributions
KolmogorovDist Generic function for the computation of the
Kolmogorov distance of two distributions
TotalVarDist Generic function for the computation of the
total variation distance of two distributions
AsymTotalVarDist Generic function for the computation of the
asymmetric total variation distance of two distributions
(for given ratio rho of negative to positive part of deviation)
OAsymTotalVarDist Generic function for the computation of the minimal (in rho)
asymmetric total variation distance of two distributions
vonMisesDist Generic function for the computation of the
von Mises distance of two distributions
liesInSupport Generic function for testing the support of a
distribution
Functionals:
E Generic function for the computation of
(conditional) expectations
var Generic functions for the computation of
functionals
IQR Generic functions for the computation of
functionals
sd Generic functions for the computation of
functionals
mad Generic functions for the computation of
functionals
median Generic functions for the computation of
functionals
skewness Generic functions for the computation of
functionals
kurtosis Generic functions for the computation of
Functionals
truncated Moments:
m1df Generic function for the computation of clipped
first moments
m2df Generic function for the computation of clipped
second moments
Demos are available — see demo(package="distrEx").
G. Jay Kerns, [email protected], has provided a major contribution,
in particular the functionals skewness and kurtosis are due to him.
You may suppress the start-up banner/message completely by setting
options("StartupBanner"="off") somewhere before loading this package by
library or require in your R-code / R-session.
If option "StartupBanner" is not defined (default) or setting
options("StartupBanner"=NULL) or
options("StartupBanner"="complete") the complete start-up banner is
displayed.
For any other value of option "StartupBanner" (i.e., not in
c(NULL,"off","complete")) only the version information is displayed.
The same can be achieved by wrapping the library or require call
into either suppressStartupMessages() or
onlytypeStartupMessages(.,atypes="version").
As for general packageStartupMessage's, you may also suppress all
the start-up banner by wrapping the library or require
call into suppressPackageStartupMessages() from
startupmsg-version 0.5 on.
Note: The first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information.
Some functions of package stats have intentionally been masked, but
completely retain their functionality — see distrExMASK().
If any of the packages e1071, moments, fBasics is to be used
together with distrEx the latter must be attached after any of the
first mentioned. Otherwise kurtosis() and skewness()
defined as methods in distrEx may get masked.
To re-mask, you
may use kurtosis <- distrEx::kurtosis; skewness <- distrEx::skewness.
See also distrExMASK()
Matthias Kohl [email protected] and
Peter Ruckdeschel [email protected],
Maintainer: Matthias Kohl [email protected]
P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): S4 Classes for Distributions, R News, 6(2), 2-6. https://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf a vignette for packages distr, distrSim, distrTEst,
and distrEx is included into the mere documentation package distrDoc
and may be called by require("distrDoc");vignette("distr")
a homepage to this package is available under
https://distr.r-forge.r-project.org/
M. Kohl (2005): Numerical Contributions to the Asymptotic
Theory of Robustness. PhD Thesis. Bayreuth. Available as
https://www.stamats.de/wp-content/uploads/2018/04/ThesisMKohl.pdf
The class of absolutely continuous conditional univariate distributions.
Objects can be created by calls of the form new("AbscontCondDistribution", ...).
condObject of class "Condition": condition
imgObject of class "rSpace": the image space.
paramObject of class "OptionalParameter": an
optional parameter.
rObject of class "function":
generates random numbers.
dObject of class "OptionalFunction":
optional conditional density function.
pObject of class "OptionalFunction":
optional conditional cumulative distribution function.
qObject of class "OptionalFunction":
optional conditional quantile function.
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetryobject of class "DistributionSymmetry";
used internally to avoid unnecessary calculations.
Class "UnivariateCondDistribution", directly.
Class "Distribution", by class "UnivariateCondDistribution".
Matthias Kohl [email protected]
UnivariateCondDistribution-class, Distribution-class
new("AbscontCondDistribution")new("AbscontCondDistribution")
Generic function for the computation of asymmetric total variation distance
of two distributions and where the distributions may be
defined for an arbitrary sample space .
For given ratio of inlier and outlier probability , this distance
is defined as
for defined by
It coincides with total variation distance for .
AsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' AsymTotalVarDist(e1,e2, rho = 1, rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'numeric,DiscreteDistribution' AsymTotalVarDist(e1, e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,numeric' AsymTotalVarDist(e1, e2, rho = 1, ...) ## S4 method for signature 'numeric,AbscontDistribution' AsymTotalVarDist(e1, e2, rho = 1, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' AsymTotalVarDist(e1, e2, rho = 1, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' AsymTotalVarDist(e1, e2, rho = 1, rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)AsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' AsymTotalVarDist(e1,e2, rho = 1, rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' AsymTotalVarDist(e1,e2, rho = 1, ...) ## S4 method for signature 'numeric,DiscreteDistribution' AsymTotalVarDist(e1, e2, rho = 1, ...) ## S4 method for signature 'DiscreteDistribution,numeric' AsymTotalVarDist(e1, e2, rho = 1, ...) ## S4 method for signature 'numeric,AbscontDistribution' AsymTotalVarDist(e1, e2, rho = 1, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' AsymTotalVarDist(e1, e2, rho = 1, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' AsymTotalVarDist(e1, e2, rho = 1, rel.tol = .Machine$double.eps^0.3, maxiter=1000, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)
e1 |
object of class |
e2 |
object of class |
asis.smooth.discretize |
possible methods are |
n.discr |
if |
low.discr |
if |
up.discr |
if |
h.smooth |
if |
rho |
ratio of inlier/outlier radius |
rel.tol |
relative tolerance for |
maxiter |
parameter for |
Ngrid |
How many grid points are to be evaluated to determine the range of the likelihood ratio? |
,
TruncQuantile |
Quantile the quantile based integration bounds (see details) |
IQR.fac |
Factor for the scale based integration bounds (see details) |
... |
further arguments to be used in particular methods – (in package distrEx: just
used for distributions with a.c. parts, where it is used to pass on arguments
to |
diagnostic |
logical; if |
For distances between absolutely continuous distributions, we use numerical
integration; to determine sensible bounds we proceed as follows:
by means of min(getLow(e1,eps=TruncQuantile),getLow(e2,eps=TruncQuantile)),
max(getUp(e1,eps=TruncQuantile),getUp(e2,eps=TruncQuantile)) we determine
quantile based bounds c(low.0,up.0), and by means of
s1 <- max(IQR(e1),IQR(e2)); m1<- median(e1);
m2 <- median(e2)
and low.1 <- min(m1,m2)-s1*IQR.fac, up.1 <- max(m1,m2)+s1*IQR.fac
we determine scale based bounds; these are combined by
low <- max(low.0,low.1), up <- max(up.0,up1).
Again in the absolutely continuous case, to determine the range of the
likelihood ratio, we evaluate this ratio on a grid constructed as follows:
x.range <- c(seq(low, up, length=Ngrid/3),
q.l(e1)(seq(0,1,length=Ngrid/3)*.999),
q.l(e2)(seq(0,1,length=Ngrid/3)*.999))
Finally, for both discrete and absolutely continuous case,
we clip this ratio downwards by 1e-10 and upwards by 1e10
In case we want to compute the total variation distance between (empirical) data
and an abs. cont. distribution, we can specify the parameter asis.smooth.discretize
to avoid trivial distances (distance = 1).
Using asis.smooth.discretize = "discretize", which is the default,
leads to a discretization of the provided abs. cont. distribution and
the distance is computed between the provided data and the discretized
distribution.
Using asis.smooth.discretize = "smooth" causes smoothing of the
empirical distribution of the provided data. This is, the empirical
data is convoluted with the normal distribution Norm(mean = 0, sd = h.smooth)
which leads to an abs. cont. distribution. Afterwards the distance
between the smoothed empirical distribution and the provided abs. cont.
distribution is computed.
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
Asymmetric Total variation distance of e1 and e2
total variation distance of two absolutely continuous
univariate distributions which is computed using distrExIntegrate.
total variation distance of absolutely continuous and discrete
univariate distributions (are mutually singular; i.e.,
have distance =1).
total variation distance of two discrete univariate distributions
which is computed using support and sum.
total variation distance of discrete and absolutely continuous
univariate distributions (are mutually singular; i.e.,
have distance =1).
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance of mixed discrete and absolutely continuous univariate distributions.
Peter Ruckdeschel [email protected]
to be filled; Agostinelli, C and Ruckdeschel, P. (2009): A simultaneous inlier and outlier model by asymmetric total variation distance.
TotalVarDist-methods, ContaminationSize,
KolmogorovDist, HellingerDist,
Distribution-class
AsymTotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8)), rho=0.3) AsymTotalVarDist(Norm(), Td(10), rho=0.3) AsymTotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100), rho=0.3) # mutually singular AsymTotalVarDist(Pois(10), Binom(size = 20), rho=0.3) x <- rnorm(100) AsymTotalVarDist(Norm(), x, rho=0.3) AsymTotalVarDist(x, Norm(), asis.smooth.discretize = "smooth", rho=0.3) y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) AsymTotalVarDist(y, Norm(), rho=0.3) AsymTotalVarDist(y, Norm(), asis.smooth.discretize = "smooth", rho=0.3) AsymTotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), rho=0.3)AsymTotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8)), rho=0.3) AsymTotalVarDist(Norm(), Td(10), rho=0.3) AsymTotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100), rho=0.3) # mutually singular AsymTotalVarDist(Pois(10), Binom(size = 20), rho=0.3) x <- rnorm(100) AsymTotalVarDist(Norm(), x, rho=0.3) AsymTotalVarDist(x, Norm(), asis.smooth.discretize = "smooth", rho=0.3) y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) AsymTotalVarDist(y, Norm(), rho=0.3) AsymTotalVarDist(y, Norm(), asis.smooth.discretize = "smooth", rho=0.3) AsymTotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), rho=0.3)
The class of conditions.
Objects can be created by calls of the form new("Condition", ...).
nameObject of class "character": name of the condition
signature(object = "Condition"): accessor function
for slot name.
signature(object = "Condition"): replacement function
for slot name.
Matthias Kohl [email protected]
UnivariateCondDistribution-class
new("Condition")new("Condition")
Generic function for the computation of convex contamination (pseudo-)distance
of two probability distributions and . That is, the
minimal size is computed such that
there exists some probability distribution with
ContaminationSize(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' ContaminationSize(e1,e2) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' ContaminationSize(e1,e2) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' ContaminationSize(e1,e2)ContaminationSize(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' ContaminationSize(e1,e2) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' ContaminationSize(e1,e2) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' ContaminationSize(e1,e2)
e1 |
object of class |
e2 |
object of class |
... |
further arguments to be used in particular methods (not in package distrEx) |
Computes the distance from e1 to e2 respectively
to . This is not really a distance as it is not symmetric!
A list containing the following components:
e1 |
object of class |
e2 |
object of class |
size.of.contamination |
size of contamination |
convex contamination (pseudo-)distance of two absolutely continuous univariate distributions.
convex contamination (pseudo-)distance of two discrete univariate distributions.
convex contamination (pseudo-)distance of two discrete univariate distributions.
Matthias Kohl [email protected],
Peter Ruckdeschel [email protected]
Huber, P.J. (1981) Robust Statistics. New York: Wiley.
KolmogorovDist, TotalVarDist,
HellingerDist, Distribution-class
ContaminationSize(Norm(), Norm(mean=0.1)) ContaminationSize(Pois(), Pois(1.5))ContaminationSize(Norm(), Norm(mean=0.1)) ContaminationSize(Pois(), Pois(1.5))
Generic function for generating convex contaminations. This is also
known as gross error model. Given two distributions
(ideal distribution), (contaminating distribution) and the
size the convex contaminated distribution
is generated.
ConvexContamination(e1, e2, size)ConvexContamination(e1, e2, size)
e1 |
object of class |
e2 |
object of class |
size |
size of contamination (amount of gross errors) |
Object of class "Distribution".
convex combination of two univariate distributions
convex combination of two absolutely continuous univariate distributions
convex combination of two discrete univariate distributions
convex combination of two univariate distributions which may be coerced to
"UnivarLebDecDistribution".
Matthias Kohl [email protected]
Huber, P.J. (1981) Robust Statistics. New York: Wiley.
ContaminationSize, Distribution-class
# Convex combination of two normal distributions C1 <- ConvexContamination(e1 = Norm(), e2 = Norm(mean = 5), size = 0.1) plot(C1)# Convex combination of two normal distributions C1 <- ConvexContamination(e1 = Norm(), e2 = Norm(mean = 5), size = 0.1) plot(C1)
Generic function for the computation of the Cramer - von Mises distance
of two distributions and where the distributions are defined
on a finite-dimensional Euclidean space
with the Borel--algebra on .
The Cramer - von Mises distance is defined as
where is coordinatewise on .
CvMDist(e1, e2, ...) ## S4 method for signature 'UnivariateDistribution,UnivariateDistribution' CvMDist(e1, e2, mu = e1, useApply = FALSE, ..., diagnostic = FALSE) ## S4 method for signature 'numeric,UnivariateDistribution' CvMDist(e1, e2, mu = e1, ..., diagnostic = FALSE)CvMDist(e1, e2, ...) ## S4 method for signature 'UnivariateDistribution,UnivariateDistribution' CvMDist(e1, e2, mu = e1, useApply = FALSE, ..., diagnostic = FALSE) ## S4 method for signature 'numeric,UnivariateDistribution' CvMDist(e1, e2, mu = e1, ..., diagnostic = FALSE)
e1 |
object of class |
e2 |
object of class |
... |
further arguments to be used e.g. by |
useApply |
logical; to be passed to |
mu |
object of class |
diagnostic |
logical; if |
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
Cramer - von Mises distance of e1 and e2
Cramer - von Mises distance of two univariate distributions.
Cramer - von Mises distance between the empirical formed from a data set (e1) and a univariate distribution.
Matthias Kohl [email protected],
Peter Ruckdeschel [email protected]
Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.
ContaminationSize, TotalVarDist,
HellingerDist, KolmogorovDist,
Distribution-class
CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8)),mu=Norm()) CvMDist(Norm(), Td(10)) CvMDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) CvMDist(Pois(10), Binom(size = 20)) CvMDist(rnorm(100),Norm()) CvMDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm()) CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5)) CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), mu = Pois())CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) CvMDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8)),mu=Norm()) CvMDist(Norm(), Td(10)) CvMDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) CvMDist(Pois(10), Binom(size = 20)) CvMDist(rnorm(100),Norm()) CvMDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm()) CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5)) CvMDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), mu = Pois())
dim-methods
signature(object = "DiscreteMVDistribution"): returns the dimension of the distribution
The class of discrete conditional univariate distributions.
Objects can be created by calls of the form new("DiscreteCondDistribution", ...).
supportObject of class "function": conditional support.
condObject of class "Condition": condition
imgObject of class "rSpace": the image space.
paramObject of class "OptionalParameter": an
optional parameter.
rObject of class "function":
generates random numbers.
dObject of class "OptionalFunction":
optional conditional density function.
pObject of class "OptionalFunction":
optional conditional cumulative distribution function.
qObject of class "OptionalFunction":
optional conditional quantile function.
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetryobject of class "DistributionSymmetry";
used internally to avoid unnecessary calculations.
Class "UnivariateCondDistribution", directly.
Class "Distribution", by class "UnivariateCondDistribution".
Matthias Kohl [email protected]
UnivariateCondDistribution-class
new("DiscreteCondDistribution")new("DiscreteCondDistribution")
Generates an object of class "DiscreteMVDistribution".
DiscreteMVDistribution(supp, prob, Symmetry = NoSymmetry())DiscreteMVDistribution(supp, prob, Symmetry = NoSymmetry())
supp |
numeric matrix whose rows form the support of the discrete multivariate distribution. |
prob |
vector of probability weights for the
elements of |
Symmetry |
you may help R in calculations if you tell it whether the distribution is non-symmetric (default) or symmetric with respect to a center. |
Typical usages are
DiscreteMVDistribution(supp, prob)
DiscreteMVDistribution(supp)
Identical rows are collapsed to unique support values.
If prob is missing, all elements in supp
are equally weighted.
Object of class "DiscreteMVDistribution"
Matthias Kohl [email protected]
# Dirac-measure at (0,0,0) D1 <- DiscreteMVDistribution(supp = c(0,0,0)) support(D1) # simple discrete distribution D2 <- DiscreteMVDistribution(supp = matrix(c(0,1,0,2,2,1,1,0), ncol=2), prob = c(0.3, 0.2, 0.2, 0.3)) support(D2) r(D2)(10)# Dirac-measure at (0,0,0) D1 <- DiscreteMVDistribution(supp = c(0,0,0)) support(D1) # simple discrete distribution D2 <- DiscreteMVDistribution(supp = matrix(c(0,1,0,2,2,1,1,0), ncol=2), prob = c(0.3, 0.2, 0.2, 0.3)) support(D2) r(D2)(10)
The class of discrete multivariate distributions.
Objects can be created by calls of the form new("DiscreteMVDistribution", ...).
More frequently they are created via the generating function
DiscreteMVDistribution.
img Object of class "rSpace".
Image space of the distribution. Usually an object of
class "EuclideanSpace".
paramObject of class "OptionalParameter".
Optional parameter of the multivariate distribution.
rObject of class "function":
generates (pseudo-)random numbers
dObject of class "OptionalFunction":
optional density function
pObject of class "OptionalFunction":
optional cumulative distribution function
qObject of class "OptionalFunction":
optional quantile function
supportnumeric matrix whose rows form the support of the distribution
.finSupportlogical: (later on to be) used internally to check whether the true support is finite; the element in the 1st row and ith column indicates whether the ith marginal distribution has a finite left endpoint, and the element in the 2nd row and ith column if it is has a finite right endpoint); not yet further used.
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Class "MultivariateDistribution", directly.
Class "Distribution", by class "MultivariateDistribution".
signature(object = "DiscreteMVDistribution"):
accessor function for slot support.
Matthias Kohl [email protected]
Distribution-class, MultivariateDistribution-class,
DiscreteMVDistribution, E-methods
(D1 <- new("MultivariateDistribution")) # Dirac measure in (0,0) r(D1)(5) (D2 <- DiscreteMVDistribution(supp = matrix(c(1:5, rep(3, 5)), ncol=2, byrow=TRUE))) support(D2) r(D2)(10) d(D2)(support(D2)) p(D2)(lower = c(1,1), upper = c(3,3)) q(D2) ## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.) param(D2) img(D2) e1 <- E(D2) # expectation(D1 <- new("MultivariateDistribution")) # Dirac measure in (0,0) r(D1)(5) (D2 <- DiscreteMVDistribution(supp = matrix(c(1:5, rep(3, 5)), ncol=2, byrow=TRUE))) support(D2) r(D2)(10) d(D2)(support(D2)) p(D2)(lower = c(1,1), upper = c(3,3)) q(D2) ## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.) param(D2) img(D2) e1 <- E(D2) # expectation
Numerical integration via integrate. In case integrate
fails a Gauss-Legendre quadrature is performed.
distrExIntegrate(f, lower, upper, subdivisions = 100, rel.tol = .Machine$double.eps^0.25, abs.tol = rel.tol, stop.on.error = TRUE, distr, order, ..., diagnostic = FALSE) showDiagnostic(x, what, withNonShows = FALSE, ...) getDiagnostic(x, what, reorganized=TRUE) ## S3 method for class 'DiagnosticClass' print(x, what, withNonShows = FALSE, xname, ...)distrExIntegrate(f, lower, upper, subdivisions = 100, rel.tol = .Machine$double.eps^0.25, abs.tol = rel.tol, stop.on.error = TRUE, distr, order, ..., diagnostic = FALSE) showDiagnostic(x, what, withNonShows = FALSE, ...) getDiagnostic(x, what, reorganized=TRUE) ## S3 method for class 'DiagnosticClass' print(x, what, withNonShows = FALSE, xname, ...)
f |
an R function taking a numeric first argument and returning a numeric vector of the same length. Returning a non-finite element will generate an error. |
lower |
lower limit of integration. Can be |
upper |
upper limit of integration. Can be |
subdivisions |
the maximum number of subintervals. |
rel.tol |
relative accuracy requested. |
abs.tol |
absolute accuracy requested. |
stop.on.error |
logical. If |
distr |
object of class |
order |
order of Gauss-Legendre quadrature. |
diagnostic |
logical; if |
... |
In case of integrators: additional arguments to be passed to |
x |
the item for which the diagnostic is to be shown. |
what |
a character vector with all the diagnostic items to be selected/shown. If empty or missing all items are selected/shown. |
withNonShows |
internally we distinguish items which are easily
printed (first kind) (numeric, logical, character)
and more difficult ones (second kind), e.g., calls, functions, lists. The
distinction is made according to the list item name. If
|
xname |
an optional name for the diagnostic object to be shown. |
reorganized |
should the diagnostic information be reorganized
(using internal function |
distrExIntegrate calls integrate. In case integrate
returns an error a Gauss-Legendre integration is performed using
GLIntegrate. If lower or (and) upper are infinite
the GLIntegrateTruncQuantile, respectively the
1-GLIntegrateTruncQuantile quantile of distr is used
instead.
distrExIntegrate is called from many places in the distr and robast
families of packages. At every such instance, diagnostic information can
be collected (setting a corresponding argument diagnostic to TRUE
in the calling function. This diagnostic information is originally stored in
a tree like list structure of S3 class DiagnosticClass which is then
attached as attribute diagnostic to the respective object. It can be
inspected and accessed through showDiagnostic and getDiagnostic.
More specifically, for any object with attribute diagnostic,
showDiagnostic shows the diagnostic collected during integration, and
getDiagnostic returns the diagnostic collected during integration.
To this end, print.DiagnosticClass is an S3 method for print
for objects of S3 class DiagnosticClass.
The value of distrExIntegrate is a numeric approximation of the integral.
If argument diagnostic==TRUE in distrExIntegrate, the return
value has an attribute diagnostic of S3 class DiagnosticClass
containing diagnostic information on the integration.
showDiagnostic, getDiagnostic, print.DiagnosticClass all
return (invisibly) a list with the selected items, reorganized by internal
function .reorganizeDiagnosticList, respectively, in case
of argument reorganized==FALSE, getDiagnostic returns (invisibly)
the diagnostic information as is.
Matthias Kohl [email protected]
Based on QUADPACK routines dqags and dqagi by
R. Piessens and E. deDoncker-Kapenga, available from Netlib.
R. Piessens, E. deDoncker-Kapenga, C. Uberhuber, D. Kahaner (1983) Quadpack: a Subroutine Package for Automatic Integration. Springer Verlag.
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery (1992) Numerical Recipies in C. The Art of Scientific Computing. Second Edition. Cambridge University Press.
integrate, GLIntegrate,
distrExOptions
fkt <- function(x){x*dchisq(x+1, df = 1)} integrate(fkt, lower = -1, upper = 3) GLIntegrate(fkt, lower = -1, upper = 3) try(integrate(fkt, lower = -1, upper = 5)) distrExIntegrate(fkt, lower = -1, upper = 5)fkt <- function(x){x*dchisq(x+1, df = 1)} integrate(fkt, lower = -1, upper = 3) GLIntegrate(fkt, lower = -1, upper = 3) try(integrate(fkt, lower = -1, upper = 5)) distrExIntegrate(fkt, lower = -1, upper = 5)
Provides information on the (intended) masking of and (non-intended) masking by other other functions in package distrEx
distrExMASK(library = NULL)distrExMASK(library = NULL)
library |
a character vector with path names of R libraries, or |
no value is returned
Peter Ruckdeschel [email protected]
## IGNORE_RDIFF_BEGIN distrExMASK() ## IGNORE_RDIFF_END## IGNORE_RDIFF_BEGIN distrExMASK() ## IGNORE_RDIFF_END
Provides information on moved of functionality from package distrEx.
distrExMOVED(library = NULL)distrExMOVED(library = NULL)
library |
a character vector with path names of R libraries, or |
no value is returned
Peter Ruckdeschel [email protected]
## IGNORE_RDIFF_BEGIN distrExMOVED() ## IGNORE_RDIFF_END## IGNORE_RDIFF_BEGIN distrExMOVED() ## IGNORE_RDIFF_END
With distrExOptions you can inspect and change
the global variables of the package distrEx.
distrExOptions(...) distrExoptions(...) getdistrExOption(x)distrExOptions(...) distrExoptions(...) getdistrExOption(x)
... |
any options can be defined, using name = value or by passing a list of such tagged values. |
x |
a character string holding an option name. |
distrExOptions() returns a list of the global variables.distrExOptions(x) returns the global variable x.getdistrExOption(x) returns the global variable x.distrExOptions(x=y) sets the value of the global variable x to y.
For compatibility with spelling in package distr, distrExoptions is
just a synonym to distrExOptions.
number of Monte-Carlo iterations used for crude
Monte-Carlo integration; defaults to 1e5.
If integrate fails and there are
infinite integration limits, the function GLIntegrate is
called inside of distrExIntegrate with the corresponding quantiles
GLIntegrateTruncQuantile respectively,
1 - GLIntegrateTruncQuantile as finite integration limits; defaults
to 10*.Machine$double.eps.
The order used for the Gauss-Legendre integration
inside of distrExIntegrate; defaults to 500.
The lower limit of integration used inside of
E which corresponds to the ElowerTruncQuantile-quantile; defaults to
1e-7.
The upper limit of integration used inside of
E which corresponds to the (1-ElowerTruncQuantile)-quantile; defaults to
1e-7.
The relative tolerance used inside of E
when calling distrExIntegrate; defaults to .Machine$double.eps^0.25.
The lower limit of integration used inside
of m1df which corresponds to the m1dfLowerTruncQuantile-quantile; defaults to 0.
The relative tolerance used inside of m1df
when calling distrExIntegrate; defaults to .Machine$double.eps^0.25.
The lower limit of integration used inside
of m2df which corresponds to the m2dfLowerTruncQuantile-quantile;
defaults to 0.
The relative tolerance used inside of m2df
when calling distrExIntegrate; defaults to .Machine$double.eps^0.25.
number of support values used for the discretization
of objects of class "AbscontDistribution"; defaults to 100.
smoothing parameter to smooth objects of class
"DiscreteDistribution". This is done via convolution with the
normal distribution Norm(mean = 0, sd = hSmooth); defaults to 0.05.
for determining sensible integration ranges, we use
both quantile and scale based methods; for the scale based
method we use the median of the distribution
IQR.fac the IQR; defaults to 15.
should names obtained from parameter
coordinates be propagated to return values of specific S4 methods
for functionals; defaults to TRUE.
Matthias Kohl [email protected]
distrExOptions() distrExOptions("ElowerTruncQuantile") distrExOptions("ElowerTruncQuantile" = 1e-6) # or distrExOptions(ElowerTruncQuantile = 1e-6) getdistrExOption("ElowerTruncQuantile")distrExOptions() distrExOptions("ElowerTruncQuantile") distrExOptions("ElowerTruncQuantile" = 1e-6) # or distrExOptions(ElowerTruncQuantile = 1e-6) getdistrExOption("ElowerTruncQuantile")
Generic function for the computation of (conditional) expectations.
E(object, fun, cond, ...) ## S4 method for signature 'UnivariateDistribution,missing,missing' E(object, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'UnivariateDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'AbscontDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,missing,ANY' E(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,function,ANY' E(object, fun, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, ...) ## S4 method for signature 'AffLinDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'AffLinUnivarLebDecDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'MultivariateDistribution,missing,missing' E(object, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'MultivariateDistribution,function,missing' E(object, fun, useApply = TRUE, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'DiscreteMVDistribution,missing,missing' E(object, low = NULL, upp = NULL, ...) ## S4 method for signature 'DiscreteMVDistribution,function,missing' E(object, fun, useApply = TRUE, ...) ## S4 method for signature 'AbscontCondDistribution,missing,numeric' E(object, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteCondDistribution,missing,numeric' E(object, cond, useApply = TRUE, low = NULL, upp = NULL, ...) ## S4 method for signature 'UnivariateCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'AbscontCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac") , ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...) ## S4 method for signature 'UnivarLebDecDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,missing,ANY' E(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,function,ANY' E(object, fun, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'AcDcLcDistribution,ANY,ANY' E(object, fun, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'CompoundDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Arcsine,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Beta,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Binom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Cauchy,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) ## S4 method for signature 'Chisq,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'DExp,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Exp,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Fd,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Gammad,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Gammad,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) ## S4 method for signature 'Geom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Lnorm,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Nbinom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Td,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Weibull,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Weibull,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) .qtlIntegrate(object, fun, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., .withLeftTail = FALSE, .withRightTail = FALSE, diagnostic = FALSE)E(object, fun, cond, ...) ## S4 method for signature 'UnivariateDistribution,missing,missing' E(object, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'UnivariateDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'AbscontDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,missing,ANY' E(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'UnivarMixingDistribution,function,ANY' E(object, fun, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, ...) ## S4 method for signature 'AffLinDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'AffLinUnivarLebDecDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'MultivariateDistribution,missing,missing' E(object, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'MultivariateDistribution,function,missing' E(object, fun, useApply = TRUE, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'DiscreteMVDistribution,missing,missing' E(object, low = NULL, upp = NULL, ...) ## S4 method for signature 'DiscreteMVDistribution,function,missing' E(object, fun, useApply = TRUE, ...) ## S4 method for signature 'AbscontCondDistribution,missing,numeric' E(object, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteCondDistribution,missing,numeric' E(object, cond, useApply = TRUE, low = NULL, upp = NULL, ...) ## S4 method for signature 'UnivariateCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...) ## S4 method for signature 'AbscontCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac") , ..., diagnostic = FALSE) ## S4 method for signature 'DiscreteCondDistribution,function,numeric' E(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...) ## S4 method for signature 'UnivarLebDecDistribution,missing,missing' E(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,function,missing' E(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,missing,ANY' E(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'UnivarLebDecDistribution,function,ANY' E(object, fun, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE ) ## S4 method for signature 'AcDcLcDistribution,ANY,ANY' E(object, fun, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ..., diagnostic = FALSE) ## S4 method for signature 'CompoundDistribution,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Arcsine,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Beta,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Binom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Cauchy,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) ## S4 method for signature 'Chisq,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'DExp,missing,missing' E(object, low = NULL, upp = NULL, ..., diagnostic = FALSE) ## S4 method for signature 'Exp,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Fd,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Gammad,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Gammad,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) ## S4 method for signature 'Geom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Lnorm,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Nbinom,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Td,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Weibull,missing,missing' E(object, low = NULL, upp = NULL, propagate.names=getdistrExOption("propagate.names.functionals"), ..., diagnostic = FALSE) ## S4 method for signature 'Weibull,function,missing' E(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., diagnostic = FALSE) .qtlIntegrate(object, fun, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(1e4,getdistrExOption("IQR.fac")), ..., .withLeftTail = FALSE, .withRightTail = FALSE, diagnostic = FALSE)
object |
object of class |
fun |
if missing the (conditional) expectation is computed
else the (conditional) expection of |
cond |
if not missing the conditional expectation
given |
Nsim |
number of MC simulations used to determine the expectation. |
rel.tol |
relative tolerance for |
low |
lower bound of integration range. |
upp |
upper bound of integration range. |
lowerTruncQuantile |
lower quantile for quantile based integration range. |
upperTruncQuantile |
upper quantile for quantile based integration range. |
IQR.fac |
factor for scale based integration range (i.e.;
median of the distribution |
... |
additional arguments to |
useApply |
logical: should |
withCond |
logical: is |
.withLeftTail |
logical: should left tail (falling into quantile range [0,0.02]) be computed separately to enhance accuracy? |
.withRightTail |
logical: should right tail (falling into quantile range [0.98,1]) be computed separately to enhance accuracy? |
diagnostic |
logical; if |
propagate.names |
logical: should names obtained from parameter
coordinates be propagated to return values of specific S4 methods
for functionals; defaults to the value of the respective
|
The precision of the computations can be controlled via
certain global options; cf. distrExOptions.
Also note that arguments low and upp should be given as
named arguments in order to prevent them to be matched by arguments
fun or cond. Also the result, when arguments
low or upp is given, is the unconditional value of the
expectation; no conditioning with respect to low <= object <= upp
is done.
For the Cauchy, the Gamma and Weibull distribution for integration with
missing argument cond but given argument fun, we use
integration on [0,1] (i.e, via the respective probability transformation).
This done via helper
function .qtlIntegrate, where both arguments .withLeftTail
and .withRightTail are TRUE for the Cauchy and Gamma distributions,
and only .withRightTail ist TRUE for the Weibull distribution.
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
The (conditional) expectation is computed.
expectation of univariate distributions using crude Monte-Carlo integration.
expectation of absolutely continuous univariate distributions
using distrExIntegrate.
expectation of discrete univariate distributions using support
and sum.
expectation of multivariate distributions using crude Monte-Carlo integration.
expectation of discrete multivariate distributions. The computation is based
on support and sum.
expectation of univariate Lebesgue decomposed distributions by separate calculations for discrete and absolutely continuous part.
expectation of an affine linear transformation as
for X either "DiscreteDistribution"
or "AbscontDistribution".
expectation of an affine linear transformation as
for X either "UnivarLebDecDistribution".
expectation of fun under univariate distributions using
crude Monte-Carlo integration.
expectation of fun under univariate Lebesgue decomposed distributions
by separate calculations for discrete and absolutely continuous part.
expectation of fun under absolutely continuous
univariate distributions using distrExIntegrate.
expectation of fun under discrete univariate
distributions using support and sum.
expectation of multivariate distributions using crude Monte-Carlo integration.
expectation of fun under discrete multivariate
distributions. The computation is based on support and sum.
conditional expectation for univariate conditional distributions given cond.
The integral is computed using crude Monte-Carlo integration.
conditional expectation for absolutely continuous, univariate
conditional distributions given cond. The computation
is based on distrExIntegrate.
conditional expectation for discrete, univariate conditional
distributions given cond. The computation is based
on support and sum.
conditional expectation of fun under univariate conditional distributions
given cond. The integral is computed using crude Monte-Carlo integration.
conditional expectation of fun under absolutely continuous,
univariate conditional distributions given cond. The
computation is based on distrExIntegrate.
conditional expectation of fun under discrete, univariate
conditional distributions given cond. The computation is
based on support and sum.
expectation by separate evaluation of expectation of discrete and abs. continuous part and subsequent weighting.
expectation by separate evaluation of expectation of discrete and abs. continuous part and subsequent weighting.
expectation by separate evaluation of expectation of discrete and abs. continuous part and subsequent weighting.
expectation by separate evaluation of expectation of discrete and abs. continuous part and subsequent weighting.
expectation is computed component-wise with subsequent weighting acc.
to mixCoeff.
expectation is computed component-wise with subsequent weighting acc.
to mixCoeff.
expectation is computed component-wise with subsequent weighting acc.
to mixCoeff.
expectation is computed component-wise with subsequent weighting acc.
to mixCoeff.
expectation by first coercing to class "UnivarLebDecDistribution"
and using the corresponding method.
if we are in i.i.d. situation (i.e., slot SummandsDistr is of
class UnivariateDistribution) the formula
for the frequency distribution and
the summand distribution; else we coerce to
"UnivarLebDecDistribution".
exact evaluation using explicit expressions.
for noncentrality 0 exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
use integration over the quantile range for numerical integration
via helper function .qtlIntegrate.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
exact evaluation using explicit expressions.
use integration over the quantile range for numerical integration
via helper function .qtlIntegrate.
Matthias Kohl [email protected] and Peter Ruckdeschel [email protected]
distrExIntegrate, m1df, m2df,
Distribution-class
# mean of Exp(1) distribution E <- Exp() E(E) ## uses explicit terms E(as(E,"AbscontDistribution")) ## uses numerical integration E(as(E,"UnivariateDistribution")) ## uses simulations E(E, fun = function(x){2*x^2}) ## uses simulations # the same operator for discrete distributions: P <- Pois(lambda=2) E(P) ## uses explicit terms E(as(P,"DiscreteDistribution")) ## uses sums E(as(P,"UnivariateDistribution")) ## uses simulations E(P, fun = function(x){2*x^2}) ## uses simulations # second moment of N(1,4) E(Norm(mean=1, sd=2), fun = function(x){x^2}) E(Norm(mean=1, sd=2), fun = function(x){x^2}, useApply = FALSE) # conditional distribution of a linear model D1 <- LMCondDistribution(theta = 1) E(D1, cond = 1) E(Norm(mean=1)) E(D1, function(x){x^2}, cond = 1) E(Norm(mean=1), fun = function(x){x^2}) E(D1, function(x, cond){cond*x^2}, cond = 2, withCond = TRUE, useApply = FALSE) E(Norm(mean=2), function(x){2*x^2}) E(as(Norm(mean=2),"AbscontDistribution")) ### somewhat less accurate: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-4,upperTruncQuantil=1e-4, IQR.fac= 4) ### even less accurate: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-2,upperTruncQuantil=1e-2, IQR.fac= 4) ### no good idea, but just as an example: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-2,upperTruncQuantil=1e-2, IQR.fac= .1) ### truncation of integration range; see also m1df... E(Norm(mean=2), low=2,upp=4) E(Cauchy()) E(Cauchy(),upp=3,low=-2) # some Lebesgue decomposed distribution mymix <- UnivarLebDecDistribution(acPart = Norm(), discretePart = Binom(4,.4), acWeight = 0.4) E(mymix)# mean of Exp(1) distribution E <- Exp() E(E) ## uses explicit terms E(as(E,"AbscontDistribution")) ## uses numerical integration E(as(E,"UnivariateDistribution")) ## uses simulations E(E, fun = function(x){2*x^2}) ## uses simulations # the same operator for discrete distributions: P <- Pois(lambda=2) E(P) ## uses explicit terms E(as(P,"DiscreteDistribution")) ## uses sums E(as(P,"UnivariateDistribution")) ## uses simulations E(P, fun = function(x){2*x^2}) ## uses simulations # second moment of N(1,4) E(Norm(mean=1, sd=2), fun = function(x){x^2}) E(Norm(mean=1, sd=2), fun = function(x){x^2}, useApply = FALSE) # conditional distribution of a linear model D1 <- LMCondDistribution(theta = 1) E(D1, cond = 1) E(Norm(mean=1)) E(D1, function(x){x^2}, cond = 1) E(Norm(mean=1), fun = function(x){x^2}) E(D1, function(x, cond){cond*x^2}, cond = 2, withCond = TRUE, useApply = FALSE) E(Norm(mean=2), function(x){2*x^2}) E(as(Norm(mean=2),"AbscontDistribution")) ### somewhat less accurate: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-4,upperTruncQuantil=1e-4, IQR.fac= 4) ### even less accurate: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-2,upperTruncQuantil=1e-2, IQR.fac= 4) ### no good idea, but just as an example: E(as(Norm(mean=2),"AbscontDistribution"), lowerTruncQuantil=1e-2,upperTruncQuantil=1e-2, IQR.fac= .1) ### truncation of integration range; see also m1df... E(Norm(mean=2), low=2,upp=4) E(Cauchy()) E(Cauchy(),upp=3,low=-2) # some Lebesgue decomposed distribution mymix <- UnivarLebDecDistribution(acPart = Norm(), discretePart = Binom(4,.4), acWeight = 0.4) E(mymix)
Generates an object of class "DiscreteMVDistribution".
EmpiricalMVDistribution(data, Symmetry = NoSymmetry())EmpiricalMVDistribution(data, Symmetry = NoSymmetry())
data |
numeric matrix with data where the rows are interpreted as observations. |
Symmetry |
you may help R in calculations if you tell it whether the distribution is non-symmetric (default) or symmetric with respect to a center. |
The function is a simple utility function providing a wrapper to the
generating function DiscreteMVDistribution.
Typical usages are
EmpiricalMVDistribution(data)
Identical rows are collapsed to unique support values.
If prob is missing, all elements in supp
are equally weighted.
Object of class "DiscreteMVDistribution"
Matthias Kohl [email protected]
## generate some data X <- matrix(rnorm(50), ncol = 5) ## empirical distribution of X D1 <- EmpiricalMVDistribution(data = X) support(D1) r(D1)(10)## generate some data X <- matrix(rnorm(50), ncol = 5) ## empirical distribution of X D1 <- EmpiricalMVDistribution(data = X) support(D1) r(D1)(10)
Generates an object of class "EuclCondition".
EuclCondition(dimension)EuclCondition(dimension)
dimension |
positive integer: dimension of the Euclidean space |
Object of class "EuclCondition"
Matthias Kohl [email protected]
EuclCondition(dimension = 3) ## The function is currently defined as function(dimension){ new("EuclCondition", Range = EuclideanSpace(dimension = dimension)) }EuclCondition(dimension = 3) ## The function is currently defined as function(dimension){ new("EuclCondition", Range = EuclideanSpace(dimension = dimension)) }
Conditioning by an Euclidean space.
Objects can be created by calls of the form new("EuclCondition", ...).
More frequently they are created via the generating function
EuclCondition.
RangeObject of class "EuclideanSpace".
nameObject of class "character": name of condition.
Class "Condition", directly.
signature(object = "EuclCondition") accessor
function for slot Range.
signature(object = "EuclCondition")
Matthias Kohl [email protected]
Condition-class, EuclCondition
new("EuclCondition")new("EuclCondition")
Gauss-Legendre quadrature over a finite interval.
GLIntegrate(f, lower, upper, order = 500, ...)GLIntegrate(f, lower, upper, order = 500, ...)
f |
an R function taking a numeric first argument and returning a numeric vector of the same length. Returning a non-finite element will generate an error. |
lower |
finite lower limit of integration. |
upper |
finite upper limit of integration. |
order |
order of Gauss-Legendre quadrature. |
... |
additional arguments to be passed to |
In case order = 100, 500, 1000 saved abscissas and weights
are used. Otherwise the corresponding abscissas and weights are
computed using the algorithm given in Section 4.5 of
Press et al. (1992).
Estimate of the integral.
Matthias Kohl [email protected]
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery (1992) Numerical Recipies in C. The Art of Scientific Computing. Second Edition. Cambridge University Press.
integrate(dnorm, -1.96, 1.96) GLIntegrate(dnorm, -1.96, 1.96)integrate(dnorm, -1.96, 1.96) GLIntegrate(dnorm, -1.96, 1.96)
Generic function for the computation of the Hellinger distance
of two distributions and which may be defined for an arbitrary
sample space . The Hellinger distance is defined as
where , respectively denotes the square root
of the densities.
HellingerDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' HellingerDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' HellingerDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' HellingerDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' HellingerDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' HellingerDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' HellingerDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)HellingerDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' HellingerDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' HellingerDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' HellingerDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' HellingerDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' HellingerDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' HellingerDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' HellingerDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)
e1 |
object of class |
e2 |
object of class |
asis.smooth.discretize |
possible methods are |
n.discr |
if |
low.discr |
if |
up.discr |
if |
h.smooth |
if |
rel.tol |
relative accuracy requested in integration |
TruncQuantile |
Quantile the quantile based integration bounds (see details) |
IQR.fac |
Factor for the scale based integration bounds (see details) |
... |
further arguments to be used in particular methods – (in package distrEx: just
used for distributions with a.c. parts, where it is used to pass on arguments
to |
diagnostic |
logical; if |
For distances between absolutely continuous distributions, we use numerical
integration; to determine sensible bounds we proceed as follows:
by means of min(getLow(e1,eps=TruncQuantile),getLow(e2,eps=TruncQuantile)),
max(getUp(e1,eps=TruncQuantile),getUp(e2,eps=TruncQuantile)) we determine
quantile based bounds c(low.0,up.0), and by means of
s1 <- max(IQR(e1),IQR(e2)); m1<- median(e1);
m2 <- median(e2)
and low.1 <- min(m1,m2)-s1*IQR.fac, up.1 <- max(m1,m2)+s1*IQR.fac
we determine scale based bounds; these are combined by
low <- max(low.0,low.1), up <- max(up.0,up1).
In case we want to compute the Hellinger distance between (empirical) data
and an abs. cont. distribution, we can specify the parameter asis.smooth.discretize
to avoid trivial distances (distance = 1).
Using asis.smooth.discretize = "discretize", which is the default,
leads to a discretization of the provided abs. cont. distribution and
the distance is computed between the provided data and the discretized
distribution.
Using asis.smooth.discretize = "smooth" causes smoothing of the
empirical distribution of the provided data. This is, the empirical
data is convoluted with the normal distribution Norm(mean = 0, sd = h.smooth)
which leads to an abs. cont. distribution. Afterwards the distance
between the smoothed empirical distribution and the provided abs. cont.
distribution is computed.
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
Hellinger distance of e1 and e2
Hellinger distance of two absolutely continuous
univariate distributions which is computed using distrExintegrate.
Hellinger distance of absolutely continuous and discrete
univariate distributions (are mutually singular; i.e.,
have distance =1).
Hellinger distance of two discrete univariate distributions
which is computed using support and sum.
Hellinger distance of discrete and absolutely continuous
univariate distributions (are mutually singular; i.e.,
have distance =1).
Hellinger distance between (empirical) data and a discrete distribution.
Hellinger distance between (empirical) data and a discrete distribution.
Hellinger distance between (empirical) data and an abs. cont. distribution.
Hellinger distance between (empirical) data and an abs. cont. distribution.
Hellinger distance of mixed discrete and absolutely continuous univariate distributions.
Matthias Kohl [email protected],
Peter Ruckdeschel [email protected]
Huber, P.J. (1981) Robust Statistics. New York: Wiley.
Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.
distrExIntegrate, ContaminationSize,
TotalVarDist, KolmogorovDist,
Distribution-class
HellingerDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) HellingerDist(Norm(), Td(10)) HellingerDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular HellingerDist(Pois(10), Binom(size = 20)) x <- rnorm(100) HellingerDist(Norm(), x) HellingerDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) HellingerDist(y, Norm()) HellingerDist(y, Norm(), asis.smooth.discretize = "smooth") HellingerDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))HellingerDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) HellingerDist(Norm(), Td(10)) HellingerDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular HellingerDist(Pois(10), Binom(size = 20)) x <- rnorm(100) HellingerDist(Norm(), x) HellingerDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) HellingerDist(y, Norm()) HellingerDist(y, Norm(), asis.smooth.discretize = "smooth") HellingerDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
Generic function for the computation of the Kolmogorov distance
of two distributions and where the distributions are defined
on a finite-dimensional Euclidean space
with the Borel--algebra on .
The Kolmogorov distance is defined as
where is coordinatewise on .
KolmogorovDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'numeric,UnivariateDistribution' KolmogorovDist(e1, e2, ...) ## S4 method for signature 'UnivariateDistribution,numeric' KolmogorovDist(e1, e2, ...) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' KolmogorovDist(e1, e2, ...)KolmogorovDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' KolmogorovDist(e1,e2, ...) ## S4 method for signature 'numeric,UnivariateDistribution' KolmogorovDist(e1, e2, ...) ## S4 method for signature 'UnivariateDistribution,numeric' KolmogorovDist(e1, e2, ...) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' KolmogorovDist(e1, e2, ...)
e1 |
object of class |
e2 |
object of class |
... |
further arguments to be used in particular methods (not in package distrEx) |
Kolmogorov distance of e1 and e2
Kolmogorov distance of two absolutely continuous univariate distributions which is computed using a union of a (pseudo-)random and a deterministic grid.
Kolmogorov distance of two discrete univariate distributions.
The distance is attained at some point of the union of the supports
of e1 and e2.
Kolmogorov distance of absolutely continuous and discrete
univariate distributions. It is computed using a union of
a (pseudo-)random and a deterministic grid in combination
with the support of e2.
Kolmogorov distance of discrete and absolutely continuous
univariate distributions. It is computed using a union of
a (pseudo-)random and a deterministic grid in combination
with the support of e1.
Kolmogorov distance between (empirical) data and a univariate
distribution. The computation is based on ks.test.
Kolmogorov distance between (empirical) data and a univariate
distribution. The computation is based on ks.test.
Kolmogorov distance of mixed discrete and absolutely continuous
univariate distributions. It is computed using a union of
the discrete part, a (pseudo-)random and
a deterministic grid in combination
with the support of e1.
Matthias Kohl [email protected],
Peter Ruckdeschel [email protected]
Huber, P.J. (1981) Robust Statistics. New York: Wiley.
Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.
ContaminationSize, TotalVarDist,
HellingerDist, Distribution-class
KolmogorovDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) KolmogorovDist(Norm(), Td(10)) KolmogorovDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) KolmogorovDist(Pois(10), Binom(size = 20)) KolmogorovDist(Norm(), rnorm(100)) KolmogorovDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm()) KolmogorovDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))KolmogorovDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) KolmogorovDist(Norm(), Td(10)) KolmogorovDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) KolmogorovDist(Pois(10), Binom(size = 20)) KolmogorovDist(Norm(), rnorm(100)) KolmogorovDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm()) KolmogorovDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
The function tests if x lies in the support of the
distribution object.
## S4 method for signature 'DiscreteMVDistribution,numeric' liesInSupport(object, x, checkFin = FALSE) ## S4 method for signature 'DiscreteMVDistribution,matrix' liesInSupport(object, x, checkFin = FALSE)## S4 method for signature 'DiscreteMVDistribution,numeric' liesInSupport(object, x, checkFin = FALSE) ## S4 method for signature 'DiscreteMVDistribution,matrix' liesInSupport(object, x, checkFin = FALSE)
object |
object of class |
x |
numeric vector or matrix |
checkFin |
logical: in case |
logical vector
does x lie in the support of object.
does x lie in the support of object.
Matthias Kohl [email protected]
M <- matrix(rpois(30, lambda = 10), ncol = 3) D1 <- DiscreteMVDistribution(M) M1 <- rbind(r(D1)(10), matrix(rpois(30, lam = 10), ncol = 3)) liesInSupport(D1, M1)M <- matrix(rpois(30, lambda = 10), ncol = 3) D1 <- DiscreteMVDistribution(M) M1 <- rbind(r(D1)(10), matrix(rpois(30, lam = 10), ncol = 3)) liesInSupport(D1, M1)
Generates an object of class "AbscontCondDistribution" which
is the conditional distribution of a linear regression model (given
the regressor).
LMCondDistribution(Error = Norm(), theta = 0, intercept = 0, scale = 1)LMCondDistribution(Error = Norm(), theta = 0, intercept = 0, scale = 1)
Error |
Object of class |
theta |
numeric vector: regression parameter. |
intercept |
real number: intercept parameter. |
scale |
positive real number: scale parameter. |
Object of class "AbscontCondDistribution"
Matthias Kohl [email protected]
AbscontCondDistribution-class, E-methods
# normal error distribution (D1 <- LMCondDistribution(theta = 1)) # corresponds to Norm(cond, 1) plot(D1) r(D1) d(D1) p(D1) q(D1) ## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.) param(D1) cond(D1) d(D1)(0, cond = 1) d(Norm(mean=1))(0) E(D1, cond = 1) E(D1, function(x){x^2}, cond = 2) E(Norm(mean=2), function(x){x^2})# normal error distribution (D1 <- LMCondDistribution(theta = 1)) # corresponds to Norm(cond, 1) plot(D1) r(D1) d(D1) p(D1) q(D1) ## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.) param(D1) cond(D1) d(D1)(0, cond = 1) d(Norm(mean=1))(0) E(D1, cond = 1) E(D1, function(x){x^2}, cond = 2) E(Norm(mean=2), function(x){x^2})
Generates an object of class "LMParameter".
LMParameter(theta = 0, intercept = 0, scale = 1)LMParameter(theta = 0, intercept = 0, scale = 1)
theta |
numeric vector: regression parameter (default |
intercept |
real number: intercept parameter (default |
scale |
positive real number: scale parameter (default |
Object of class "LMParameter"
Matthias Kohl [email protected]
LMParameter(theta = c(1,1), intercept = 2, scale = 0.5) ## The function is currently defined as function(theta = 0, intercept = 0, scale = 1){ new("LMParameter", theta = theta, intercept = intercept, scale = 1) }LMParameter(theta = c(1,1), intercept = 2, scale = 0.5) ## The function is currently defined as function(theta = 0, intercept = 0, scale = 1){ new("LMParameter", theta = theta, intercept = intercept, scale = 1) }
Parameter of a linear regression model
with intercept , regression parameter
and error scale .
Objects can be created by calls of the form new("LMParameter", ...).
More frequently they are created via the generating function
LMParameter.
thetanumeric vector: regression parameter.
interceptreal number: intercept parameter.
scalepositive real number: scale paramter.
namecharacter vector: the default name is “parameter of a linear regression model”.
Class "Parameter", directly.
Class "OptionalParameter", by class "Parameter".
signature(object = "LMParameter")
Matthias Kohl [email protected]
new("LMParameter")new("LMParameter")
Generic function for the computation of clipped first moments.
The moments are clipped at upper.
m1df(object, upper, ...) ## S4 method for signature 'AbscontDistribution' m1df(object, upper, lowerTruncQuantile = getdistrExOption("m1dfLowerTruncQuantile"), rel.tol = getdistrExOption("m1dfRelativeTolerance"), ...)m1df(object, upper, ...) ## S4 method for signature 'AbscontDistribution' m1df(object, upper, lowerTruncQuantile = getdistrExOption("m1dfLowerTruncQuantile"), rel.tol = getdistrExOption("m1dfRelativeTolerance"), ...)
object |
object of class |
upper |
clipping bound |
rel.tol |
relative tolerance for |
lowerTruncQuantile |
lower quantile for quantile based integration range. |
... |
additional arguments to |
The precision of the computations can be controlled via
certain global options; cf. distrExOptions.
The first moment of object clipped at upper is computed.
uses call E(object, upp=upper, ...).
clipped first moment
for absolutely continuous univariate distributions which is
computed using integrate.
clipped first moment
for discrete univariate distributions which is computed
using support and sum.
clipped first moment
for affine linear distributions which is computed on basis of
slot X0.
clipped first moment
for Binomial distributions which is computed using pbinom.
clipped first moment
for Poisson distributions which is computed using ppois.
clipped first moment
for normal distributions which is computed using dnorm and pnorm.
clipped first moment
for exponential distributions which is computed using pexp.
clipped first moment
for distributions which is computed using pchisq.
Matthias Kohl [email protected]
# standard normal distribution N1 <- Norm() m1df(N1, 0) # Poisson distribution P1 <- Pois(lambda=2) m1df(P1, 3) m1df(P1, 3, fun = function(x)sin(x)) # absolutely continuous distribution D1 <- Norm() + Exp() # convolution m1df(D1, 2) m1df(D1, Inf) E(D1)# standard normal distribution N1 <- Norm() m1df(N1, 0) # Poisson distribution P1 <- Pois(lambda=2) m1df(P1, 3) m1df(P1, 3, fun = function(x)sin(x)) # absolutely continuous distribution D1 <- Norm() + Exp() # convolution m1df(D1, 2) m1df(D1, Inf) E(D1)
Generic function for the computation of clipped second moments.
The moments are clipped at upper.
m2df(object, upper, ...) ## S4 method for signature 'AbscontDistribution' m2df(object, upper, lowerTruncQuantile = getdistrExOption("m2dfLowerTruncQuantile"), rel.tol = getdistrExOption("m2dfRelativeTolerance"), ...)m2df(object, upper, ...) ## S4 method for signature 'AbscontDistribution' m2df(object, upper, lowerTruncQuantile = getdistrExOption("m2dfLowerTruncQuantile"), rel.tol = getdistrExOption("m2dfRelativeTolerance"), ...)
object |
object of class |
upper |
clipping bound |
rel.tol |
relative tolerance for |
lowerTruncQuantile |
lower quantile for quantile based integration range. |
... |
additional arguments to |
The precision of the computations can be controlled via
certain global options; cf. distrExOptions.
The second moment of object clipped at upper is computed.
uses call E(object, upp=upper, fun = function, ...).
clipped second moment
for absolutely continuous univariate distributions which is
computed using integrate.
clipped second moment
for discrete univariate distributions which is computed
using support and sum.
clipped second moment
for affine linear distributions which is computed on basis of
slot X0.
clipped second moment
for Binomial distributions which is computed using pbinom.
clipped second moment
for Poisson distributions which is computed using ppois.
clipped second moment
for normal distributions which is computed using dnorm and pnorm.
clipped second moment
for exponential distributions which is computed using pexp.
clipped second moment
for distributions which is computed using pchisq.
Matthias Kohl [email protected]
# standard normal distribution N1 <- Norm() m2df(N1, 0) # Poisson distribution P1 <- Pois(lambda=2) m2df(P1, 3) m2df(P1, 3, fun = function(x)sin(x)) # absolutely continuous distribution D1 <- Norm() + Exp() # convolution m2df(D1, 2) m2df(D1, Inf) E(D1, function(x){x^2})# standard normal distribution N1 <- Norm() m2df(N1, 0) # Poisson distribution P1 <- Pois(lambda=2) m2df(P1, 3) m2df(P1, 3, fun = function(x)sin(x)) # absolutely continuous distribution D1 <- Norm() + Exp() # convolution m2df(D1, 2) m2df(D1, Inf) E(D1, function(x){x^2})
The function make01 produces a new centered and
standardized univariate distribution.
make01(x)make01(x)
x |
an object of class |
Thanks to the functionals provided in this package, the code is
a one-liner: (x-E(x))/sd(x).
Object of class "UnivariateDistribution" with expectation 0 and variance 1.
Peter Ruckdeschel [email protected]
E, Var
X <- sin(exp(2*log(abs( Norm())))) ## something weird X01 <- make01(X) print(X01) plot(X01) sd(X01); E(X01)X <- sin(exp(2*log(abs( Norm())))) ## something weird X01 <- make01(X) print(X01) plot(X01) sd(X01); E(X01)
The class of multivariate distributions. One has at least to
specify the image space of the distribution and a function generating
(pseudo-)random numbers. The slot q is usually filled with
NULL for dimensions > 1.
Objects can be created by calls of the form new("MultivariateDistribution", ...).
img Object of class "rSpace".
Image space of the distribution. Usually an object of
class "EuclideanSpace".
paramObject of class "OptionalParameter".
Optional parameter of the multivariate distribution.
rObject of class "function":
generates (pseudo-)random numbers
dObject of class "OptionalFunction":
optional density function
pObject of class "OptionalFunction":
optional cumulative distribution function
qObject of class "OptionalFunction":
optional quantile function
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetryobject of class "DistributionSymmetry";
used internally to avoid unnecessary calculations.
Class "Distribution", directly.
signature(object = "MultivariateDistribution")
signature(object = "MultivariateDistribution"):
not yet implemented.
Matthias Kohl [email protected]
# Dirac-measure in (0,0) new("MultivariateDistribution")# Dirac-measure in (0,0) new("MultivariateDistribution")
Generic function for the computation of (minimal) asymmetric total variation distance
of two distributions and where the distributions may be
defined for an arbitrary sample space .
This distance is defined as
OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' OAsymTotalVarDist(e1,e2, rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' OAsymTotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' OAsymTotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' OAsymTotalVarDist(e1, e2, rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' OAsymTotalVarDist(e1,e2, rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' OAsymTotalVarDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' OAsymTotalVarDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' OAsymTotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' OAsymTotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' OAsymTotalVarDist(e1, e2, rel.tol = .Machine$double.eps^0.3, Ngrid = 10000, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)
e1 |
object of class |
e2 |
object of class |
asis.smooth.discretize |
possible methods are |
n.discr |
if |
low.discr |
if |
up.discr |
if |
h.smooth |
if |
rel.tol |
relative tolerance for |
Ngrid |
How many grid points are to be evaluated to determine the range of the likelihood ratio? |
,
TruncQuantile |
Quantile the quantile based integration bounds (see details) |
IQR.fac |
Factor for the scale based integration bounds (see details) |
... |
further arguments to be used in particular methods – (in package distrEx: just
used for distributions with a.c. parts, where it is used to pass on arguments
to |
diagnostic |
logical; if |
For distances between absolutely continuous distributions, we use numerical
integration; to determine sensible bounds we proceed as follows:
by means of min(getLow(e1,eps=TruncQuantile),getLow(e2,eps=TruncQuantile)),
max(getUp(e1,eps=TruncQuantile),getUp(e2,eps=TruncQuantile)) we determine
quantile based bounds c(low.0,up.0), and by means of
s1 <- max(IQR(e1),IQR(e2)); m1<- median(e1);
m2 <- median(e2)
and low.1 <- min(m1,m2)-s1*IQR.fac, up.1 <- max(m1,m2)+s1*IQR.fac
we determine scale based bounds; these are combined by
low <- max(low.0,low.1), up <- max(up.0,up1).
Again in the absolutely continuous case, to determine the range of the
likelihood ratio, we evaluate this ratio on a grid constructed as follows:
x.range <- c(seq(low, up, length=Ngrid/3),
q.l(e1)(seq(0,1,length=Ngrid/3)*.999),
q.l(e2)(seq(0,1,length=Ngrid/3)*.999))
Finally, for both discrete and absolutely continuous case,
we clip this ratio downwards by 1e-10 and upwards by 1e10
In case we want to compute the total variation distance between (empirical) data
and an abs. cont. distribution, we can specify the parameter asis.smooth.discretize
to avoid trivial distances (distance = 1).
Using asis.smooth.discretize = "discretize", which is the default,
leads to a discretization of the provided abs. cont. distribution and
the distance is computed between the provided data and the discretized
distribution.
Using asis.smooth.discretize = "smooth" causes smoothing of the
empirical distribution of the provided data. This is, the empirical
data is convoluted with the normal distribution Norm(mean = 0, sd = h.smooth)
which leads to an abs. cont. distribution. Afterwards the distance
between the smoothed empirical distribution and the provided abs. cont.
distribution is computed.
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
OAsymmetric Total variation distance of e1 and e2
total variation distance of two absolutely continuous
univariate distributions which is computed using distrExIntegrate.
total variation distance of absolutely continuous and discrete
univariate distributions (are mutually singular; i.e.,
have distance =1).
total variation distance of two discrete univariate distributions
which is computed using support and sum.
total variation distance of discrete and absolutely continuous
univariate distributions (are mutually singular; i.e.,
have distance =1).
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance of mixed discrete and absolutely continuous univariate distributions.
Peter Ruckdeschel [email protected]
to be filled; Agostinelli, C and Ruckdeschel, P. (2009): A simultaneous inlier and outlier model by asymmetric total variation distance.
TotalVarDist-methods, ContaminationSize,
KolmogorovDist, HellingerDist,
Distribution-class
OAsymTotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) OAsymTotalVarDist(Norm(), Td(10)) OAsymTotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular OAsymTotalVarDist(Pois(10), Binom(size = 20)) x <- rnorm(100) OAsymTotalVarDist(Norm(), x) OAsymTotalVarDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) OAsymTotalVarDist(y, Norm()) OAsymTotalVarDist(y, Norm(), asis.smooth.discretize = "smooth") OAsymTotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))OAsymTotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) OAsymTotalVarDist(Norm(), Td(10)) OAsymTotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular OAsymTotalVarDist(Pois(10), Binom(size = 20)) x <- rnorm(100) OAsymTotalVarDist(Norm(), x) OAsymTotalVarDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) OAsymTotalVarDist(y, Norm()) OAsymTotalVarDist(y, Norm(), asis.smooth.discretize = "smooth") OAsymTotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
plot-methods
plot(x, y, ...) ## S4 method for signature 'UnivariateCondDistribution,missing' plot(x, y, ...) ## S4 method for signature 'MultivariateDistribution,missing' plot(x, y, ...)plot(x, y, ...) ## S4 method for signature 'UnivariateCondDistribution,missing' plot(x, y, ...) ## S4 method for signature 'MultivariateDistribution,missing' plot(x, y, ...)
x |
object of class
|
y |
missing |
... |
addtional arguments |
upto now only warnings are issued that the corresponding method is not yet implemented;
Generates an object of class "PrognCondDistribution".
PrognCondDistribution(Regr, Error, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"))PrognCondDistribution(Regr, Error, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"))
Regr |
object of class |
Error |
object of class |
rel.tol |
relative tolerance for |
lowerTruncQuantile |
lower quantile for quantile based integration range. |
upperTruncQuantile |
upper quantile for quantile based integration range. |
IQR.fac |
factor for scale based integration range (i.e.;
median of the distribution |
For independent r.v.'s X,E with univariate, absolutely continuous
(a.c.) distributions Regr and Error, respectively,
PrognCondDistribution() returns the
(factorized, conditional) posterior distribution of X given X+E=y.
as an object of class PrognCondDistribution.
Object of class "PrognCondDistribution"
Peter Ruckdeschel [email protected],
PrognCondDistribution-class; demo(‘Prognose.R’).
PrognCondDistribution(Error = ConvexContamination(Norm(), Norm(4,1), size=0.1))PrognCondDistribution(Error = ConvexContamination(Norm(), Norm(4,1), size=0.1))
The posterior distribution of X given (X+E)=y
Objects can be created by calls of the form PrognCondDistribution
where Regr and error are the respective (a.c.) distributions of X and E
and the other arguments control accuracy in integration.
cond:Object of class "PrognCondition": condition
img:Object of class "rSpace": the image space.
param:Object of class "OptionalParameter": an
optional parameter.
r:Object of class "function":
generates random numbers.
d:Object of class "OptionalFunction":
optional conditional density function.
p:Object of class "OptionalFunction":
optional conditional cumulative distribution function.
q:Object of class "OptionalFunction":
optional conditional quantile function.
gaps:(numeric) matrix or NULL
.withArith:logical: used internally to issue warnings as to interpretation of arithmetics
.withSim:logical: used internally to issue warnings as to accuracy
.logExact:logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExact:logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Class "AbscontCondDistribution", directly.
Class "Distribution", by classes "UnivariateCondDistribution" and "AbscontCondDistribution".
Matthias Kohl [email protected]
PrognCondition-class, UnivariateCondDistribution-class
AbscontCondDistribution-class, Distribution-class
PrognCondDistribution()PrognCondDistribution()
The class PrognCondition realizes the condition that X+E=y in a convolution setup
PrognCondition(range = EuclideanSpace())PrognCondition(range = EuclideanSpace())
range |
an object of class |
Object of class "PrognCondition"
Objects can be created by calls of the form PrognCondition(range).
nameObject of class "character": name of the PrognCondition
rangeObject of class "EuclideanSpace": range of the PrognCondition
Class "Condition", directly.
signature(object = "PrognCondition")
Matthias Kohl [email protected]
PrognCondDistribution-class,Condition-class
PrognCondition()PrognCondition()
Generic function for the computation of the total variation distance
of two distributions and where the distributions may be
defined for an arbitrary sample space .
The total variation distance is defined as
TotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' TotalVarDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' TotalVarDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' TotalVarDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' TotalVarDist(e1, e2, rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)TotalVarDist(e1, e2, ...) ## S4 method for signature 'AbscontDistribution,AbscontDistribution' TotalVarDist(e1,e2, rel.tol=.Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,DiscreteDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,AbscontDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'DiscreteDistribution,DiscreteDistribution' TotalVarDist(e1,e2, ...) ## S4 method for signature 'numeric,DiscreteDistribution' TotalVarDist(e1, e2, ...) ## S4 method for signature 'DiscreteDistribution,numeric' TotalVarDist(e1, e2, ...) ## S4 method for signature 'numeric,AbscontDistribution' TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e2), up.discr = getUp(e2), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AbscontDistribution,numeric' TotalVarDist(e1, e2, asis.smooth.discretize = "discretize", n.discr = getdistrExOption("nDiscretize"), low.discr = getLow(e1), up.discr = getUp(e1), h.smooth = getdistrExOption("hSmooth"), rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE) ## S4 method for signature 'AcDcLcDistribution,AcDcLcDistribution' TotalVarDist(e1, e2, rel.tol = .Machine$double.eps^0.3, TruncQuantile = getdistrOption("TruncQuantile"), IQR.fac = 15, ..., diagnostic = FALSE)
e1 |
object of class |
e2 |
object of class |
asis.smooth.discretize |
possible methods are |
n.discr |
if |
low.discr |
if |
up.discr |
if |
h.smooth |
if |
rel.tol |
relative accuracy requested in integration |
TruncQuantile |
Quantile the quantile based integration bounds (see details) |
IQR.fac |
Factor for the scale based integration bounds (see details) |
... |
further arguments to be used in particular methods – (in package distrEx: just
used for distributions with a.c. parts, where it is used to pass on arguments
to |
diagnostic |
logical; if |
For distances between absolutely continuous distributions, we use numerical
integration; to determine sensible bounds we proceed as follows:
by means of min(getLow(e1,eps=TruncQuantile),getLow(e2,eps=TruncQuantile)),
max(getUp(e1,eps=TruncQuantile),getUp(e2,eps=TruncQuantile)) we determine
quantile based bounds c(low.0,up.0), and by means of
s1 <- max(IQR(e1),IQR(e2)); m1<- median(e1);
m2 <- median(e2)
and low.1 <- min(m1,m2)-s1*IQR.fac, up.1 <- max(m1,m2)+s1*IQR.fac
we determine scale based bounds; these are combined by
low <- max(low.0,low.1), up <- max(up.0,up1).
In case we want to compute the total variation distance between (empirical) data
and an abs. cont. distribution, we can specify the parameter asis.smooth.discretize
to avoid trivial distances (distance = 1).
Using asis.smooth.discretize = "discretize", which is the default,
leads to a discretization of the provided abs. cont. distribution and
the distance is computed between the provided data and the discretized
distribution.
Using asis.smooth.discretize = "smooth" causes smoothing of the
empirical distribution of the provided data. This is, the empirical
data is convoluted with the normal distribution Norm(mean = 0, sd = h.smooth)
which leads to an abs. cont. distribution. Afterwards the distance
between the smoothed empirical distribution and the provided abs. cont.
distribution is computed.
Diagnostics on the involved integrations are available if argument
diagnostic is TRUE. Then there is attribute diagnostic
attached to the return value, which may be inspected
and accessed through showDiagnostic and
getDiagnostic.
Total variation distance of e1 and e2
total variation distance of two absolutely continuous
univariate distributions which is computed using distrExIntegrate.
total variation distance of absolutely continuous and discrete
univariate distributions (are mutually singular; i.e.,
have distance =1).
total variation distance of two discrete univariate distributions
which is computed using support and sum.
total variation distance of discrete and absolutely continuous
univariate distributions (are mutually singular; i.e.,
have distance =1).
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and a discrete distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance between (empirical) data and an abs. cont. distribution.
Total variation distance of mixed discrete and absolutely continuous univariate distributions.
Matthias Kohl [email protected],
Peter Ruckdeschel [email protected]
Huber, P.J. (1981) Robust Statistics. New York: Wiley.
Rieder, H. (1994) Robust Asymptotic Statistics. New York: Springer.
TotalVarDist-methods, ContaminationSize,
KolmogorovDist, HellingerDist,
Distribution-class
TotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) TotalVarDist(Norm(), Td(10)) TotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular TotalVarDist(Pois(10), Binom(size = 20)) x <- rnorm(100) TotalVarDist(Norm(), x) TotalVarDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) TotalVarDist(y, Norm()) TotalVarDist(y, Norm(), asis.smooth.discretize = "smooth") TotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))TotalVarDist(Norm(), UnivarMixingDistribution(Norm(1,2),Norm(0.5,3), mixCoeff=c(0.2,0.8))) TotalVarDist(Norm(), Td(10)) TotalVarDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100)) # mutually singular TotalVarDist(Pois(10), Binom(size = 20)) x <- rnorm(100) TotalVarDist(Norm(), x) TotalVarDist(x, Norm(), asis.smooth.discretize = "smooth") y <- (rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5) TotalVarDist(y, Norm()) TotalVarDist(y, Norm(), asis.smooth.discretize = "smooth") TotalVarDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
Class of univariate conditional distributions.
Objects can be created by calls of the form new("UnivariateCondDistribution", ...).
condObject of class "Condition": condition
imgObject of class "rSpace": the image space.
paramObject of class "OptionalParameter": an
optional parameter.
rObject of class "function":
generates random numbers.
dObject of class "OptionalFunction":
optional conditional density function.
pObject of class "OptionalFunction":
optional conditional cumulative distribution function.
qObject of class "OptionalFunction":
optional conditional quantile function.
.withArithlogical: used internally to issue warnings as to interpretation of arithmetics
.withSimlogical: used internally to issue warnings as to accuracy
.logExactlogical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExactlogical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetryobject of class "DistributionSymmetry";
used internally to avoid unnecessary calculations.
Class "UnivariateDistribution", directly.
Class "Distribution", by class "UnivariateDistribution".
signature(object = "UnivariateCondDistribution"):
accessor function for slot cond.
signature(object = "UnivariateCondDistribution")
signature(object = "UnivariateCondDistribution"):
not yet implemented.
Matthias Kohl [email protected]
new("UnivariateCondDistribution")new("UnivariateCondDistribution")
Generic functions for the computation of functionals on distributions.
IQR(x, ...) ## S4 method for signature 'UnivariateDistribution' IQR(x) ## S4 method for signature 'UnivariateCondDistribution' IQR(x,cond) ## S4 method for signature 'AffLinDistribution' IQR(x) ## S4 method for signature 'DiscreteDistribution' IQR(x) ## S4 method for signature 'Arcsine' IQR(x) ## S4 method for signature 'Cauchy' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' IQR(x) ## S4 method for signature 'DExp' IQR(x) ## S4 method for signature 'Exp' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) median(x, ...) ## S4 method for signature 'UnivariateDistribution' median(x) ## S4 method for signature 'UnivariateCondDistribution' median(x,cond) ## S4 method for signature 'AffLinDistribution' median(x) ## S4 method for signature 'Arcsine' median(x) ## S4 method for signature 'Cauchy' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'DExp' median(x) ## S4 method for signature 'Exp' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Lnorm' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) mad(x, ...) ## S4 method for signature 'UnivariateDistribution' mad(x) ## S4 method for signature 'AffLinDistribution' mad(x) ## S4 method for signature 'Cauchy' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' mad(x) ## S4 method for signature 'DExp' mad(x) ## S4 method for signature 'Exp' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Arcsine' mad(x) sd(x, ...) ## S4 method for signature 'UnivariateDistribution' sd(x, fun, cond, withCond, useApply, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' sd(x, fun, cond, withCond = FALSE, useApply = TRUE, propagate.names=getdistrExOption("propagate.names.functionals"), ...) var(x, ...) ## S4 method for signature 'UnivariateDistribution' var(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' var(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'CompoundDistribution' var(x, ...) ## S4 method for signature 'Arcsine' var(x, ...) ## S4 method for signature 'Binom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' var(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Cauchy' var(x, ...) ## S4 method for signature 'Chisq' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' var(x, ...) ## S4 method for signature 'DExp' var(x, ...) ## S4 method for signature 'Exp' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Fd' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Lnorm' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Td' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Weibull' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) skewness(x, ...) ## S4 method for signature 'UnivariateDistribution' skewness(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' skewness(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'Arcsine' skewness(x, ...) ## S4 method for signature 'Binom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Chisq' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' skewness(x, ...) ## S4 method for signature 'DExp' skewness(x, ...) ## S4 method for signature 'Exp' skewness(x, ...) ## S4 method for signature 'Fd' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' skewness(x, ...) ## S4 method for signature 'Lnorm' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Td' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif' skewness(x, ...) ## S4 method for signature 'Weibull' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) kurtosis(x, ...) ## S4 method for signature 'UnivariateDistribution' kurtosis(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' kurtosis(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'Arcsine' kurtosis(x, ...) ## S4 method for signature 'Binom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy' kurtosis(x, ...) ## S4 method for signature 'Chisq' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' kurtosis(x, ...) ## S4 method for signature 'DExp' kurtosis(x, ...) ## S4 method for signature 'Exp' kurtosis(x, ...) ## S4 method for signature 'Fd' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' kurtosis(x, ...) ## S4 method for signature 'Lnorm' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Norm' kurtosis(x, ...) ## S4 method for signature 'Pois' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Td' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Unif' kurtosis(x, ...) ## S4 method for signature 'Weibull' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...)IQR(x, ...) ## S4 method for signature 'UnivariateDistribution' IQR(x) ## S4 method for signature 'UnivariateCondDistribution' IQR(x,cond) ## S4 method for signature 'AffLinDistribution' IQR(x) ## S4 method for signature 'DiscreteDistribution' IQR(x) ## S4 method for signature 'Arcsine' IQR(x) ## S4 method for signature 'Cauchy' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' IQR(x) ## S4 method for signature 'DExp' IQR(x) ## S4 method for signature 'Exp' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' IQR(x, propagate.names=getdistrExOption("propagate.names.functionals")) median(x, ...) ## S4 method for signature 'UnivariateDistribution' median(x) ## S4 method for signature 'UnivariateCondDistribution' median(x,cond) ## S4 method for signature 'AffLinDistribution' median(x) ## S4 method for signature 'Arcsine' median(x) ## S4 method for signature 'Cauchy' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'DExp' median(x) ## S4 method for signature 'Exp' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Lnorm' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' median(x, propagate.names=getdistrExOption("propagate.names.functionals")) mad(x, ...) ## S4 method for signature 'UnivariateDistribution' mad(x) ## S4 method for signature 'AffLinDistribution' mad(x) ## S4 method for signature 'Cauchy' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Dirac' mad(x) ## S4 method for signature 'DExp' mad(x) ## S4 method for signature 'Exp' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Geom' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Logis' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Norm' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Unif' mad(x, propagate.names=getdistrExOption("propagate.names.functionals")) ## S4 method for signature 'Arcsine' mad(x) sd(x, ...) ## S4 method for signature 'UnivariateDistribution' sd(x, fun, cond, withCond, useApply, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' sd(x, fun, cond, withCond = FALSE, useApply = TRUE, propagate.names=getdistrExOption("propagate.names.functionals"), ...) var(x, ...) ## S4 method for signature 'UnivariateDistribution' var(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' var(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'CompoundDistribution' var(x, ...) ## S4 method for signature 'Arcsine' var(x, ...) ## S4 method for signature 'Binom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' var(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Cauchy' var(x, ...) ## S4 method for signature 'Chisq' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' var(x, ...) ## S4 method for signature 'DExp' var(x, ...) ## S4 method for signature 'Exp' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Fd' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Lnorm' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Td' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Weibull' var(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) skewness(x, ...) ## S4 method for signature 'UnivariateDistribution' skewness(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' skewness(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'Arcsine' skewness(x, ...) ## S4 method for signature 'Binom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Chisq' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' skewness(x, ...) ## S4 method for signature 'DExp' skewness(x, ...) ## S4 method for signature 'Exp' skewness(x, ...) ## S4 method for signature 'Fd' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' skewness(x, ...) ## S4 method for signature 'Lnorm' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Norm' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Pois' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Td' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Unif' skewness(x, ...) ## S4 method for signature 'Weibull' skewness(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) kurtosis(x, ...) ## S4 method for signature 'UnivariateDistribution' kurtosis(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'AffLinDistribution' kurtosis(x, fun, cond, withCond, useApply, ...) ## S4 method for signature 'Arcsine' kurtosis(x, ...) ## S4 method for signature 'Binom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Beta' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Cauchy' kurtosis(x, ...) ## S4 method for signature 'Chisq' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Dirac' kurtosis(x, ...) ## S4 method for signature 'DExp' kurtosis(x, ...) ## S4 method for signature 'Exp' kurtosis(x, ...) ## S4 method for signature 'Fd' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Gammad' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Geom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Hyper' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Logis' kurtosis(x, ...) ## S4 method for signature 'Lnorm' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...) ## S4 method for signature 'Nbinom' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Norm' kurtosis(x, ...) ## S4 method for signature 'Pois' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Td' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"),...) ## S4 method for signature 'Unif' kurtosis(x, ...) ## S4 method for signature 'Weibull' kurtosis(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...)
x |
object of class |
fun |
if missing the (conditional) variance resp. standard deviation is computed
else the (conditional) variance resp. standard deviation of |
cond |
if not missing the conditional variance resp. standard deviation
given |
... |
additional arguments to |
useApply |
logical: should |
withCond |
logical: is |
propagate.names |
logical: should names obtained from parameter
coordinates be propagated to return values of specific S4 methods
for functionals; defaults to the value of the respective
|
The value of the corresponding functional at the distribution in the argument is computed.
var, signature(x = "Any"):interface to the stats-function var — see var
resp. help(var,package="stats").
var, signature(x = "UnivariateDistribution"):variance of univariate distributions using corresponding E()-method.
var, signature(x = "AffLinDistribution"):if arguments fun, cond are missing: x@a^2 * var(x@X0)
else uses method for signature(x = "UnivariateDistribution")
var, signature(x = "CompoundDistribution"):if we are in i.i.d. situation (i.e., slot SummandsDistr is of
class UnivariateDistribution) the formula
for the frequency distribution and
the summand distribution; else we coerce to
"UnivarLebDecDistribution".
sd, signature(x = "Any"):interface to the stats-function sd — see sd
resp. help(sd,package="stats").
sd, signature(x = "NormParameter"):returns the slot sd of the parameter of a normal distribution — see
sd resp. help(sd,package="distr").
sd, signature(x = "Norm"):returns the slot sd of the parameter of a normal distribution — see
sd resp. help(sd,package="distr").
sd, signature(x = "UnivariateDistribution"):standard deviation of univariate distributions using corresponding E()-method.
IQR, signature(x = "Any"):interface to the stats-function IQR — see IQR
resp. help(IQR,package="stats").
IQR, signature(x = "UnivariateDistribution"):interquartile range of univariate distributions using corresponding q()-method.
IQR, signature(x = "UnivariateCondDistribution"):interquartile range of univariate conditional distributions using corresponding q()-method.
IQR, signature(x = "DiscreteDistribution"):interquartile range of discrete distributions using corresponding
q()-method but taking care that between upper and lower quartile
there is 50% probability
IQR, signature(x = "AffLinDistribution"):abs(x@a) * IQR(x@X0)
median, signature(x = "Any"):interface to the stats-function median — see median
resp. help(var,package="stats").
median, signature(x = "UnivariateDistribution"):median of univariate distributions using corresponding q()-method.
median, signature(x = "UnivariateCondDistribution"):median of univariate conditional distributions using corresponding q()-method.
median, signature(x = "AffLinDistribution"):x@a * median(x@X0) + x@b
mad, signature(x = "Any"):interface to the stats-function mad — see mad.
mad, signature(x = "UnivariateDistribution"):mad of univariate distributions using corresponding q()-method applied to abs(x-median(x)).
mad, signature(x = "AffLinDistribution"):abs(x@a) * mad(x@X0)
skewness, signature(x = "Any"):bias free estimation of skewness under normal distribution (default) as
well as sample version (by argument sample.version = TRUE).
skewness, signature(x = "UnivariateDistribution"):skewness of univariate distributions using corresponding E()-method.
skewness, signature(x = "AffLinDistribution"):if arguments fun, cond are missing: skewness(x@X0)
else uses method for signature(x = "UnivariateDistribution")
kurtosis, signature(x = "Any"):bias free estimation of kurtosis under normal distribution (default) as
well as sample version (by argument sample.version = TRUE).
kurtosis, signature(x = "UnivariateDistribution"):kurtosis of univariate distributions using corresponding E()-method.
kurtosis, signature(x = "AffLinDistribution"):if arguments fun, cond are missing: kurtosis(x@X0)
else uses method for signature(x = "UnivariateDistribution")
var, signature(x = "Arcsine"):exact evaluation using explicit expressions.
var, signature(x = "Beta"):for noncentrality 0 exact evaluation using explicit expressions.
var, signature(x = "Binom"):exact evaluation using explicit expressions.
var, signature(x = "Cauchy"):exact evaluation using explicit expressions.
var, signature(x = "Chisq"):exact evaluation using explicit expressions.
var, signature(x = "Dirac"):exact evaluation using explicit expressions.
var, signature(x = "DExp"):exact evaluation using explicit expressions.
var, signature(x = "Exp"):exact evaluation using explicit expressions.
var, signature(x = "Fd"):exact evaluation using explicit expressions.
var, signature(x = "Gammad"):exact evaluation using explicit expressions.
var, signature(x = "Geom"):exact evaluation using explicit expressions.
var, signature(x = "Hyper"):exact evaluation using explicit expressions.
var, signature(x = "Logis"):exact evaluation using explicit expressions.
var, signature(x = "Lnorm"):exact evaluation using explicit expressions.
var, signature(x = "Nbinom"):exact evaluation using explicit expressions.
var, signature(x = "Norm"):exact evaluation using explicit expressions.
var, signature(x = "Pois"):exact evaluation using explicit expressions.
var, signature(x = "Td"):exact evaluation using explicit expressions.
var, signature(x = "Unif"):exact evaluation using explicit expressions.
var, signature(x = "Weibull"):exact evaluation using explicit expressions.
IQR, signature(x = "Arcsine"):exact evaluation using explicit expressions.
IQR, signature(x = "Cauchy"):exact evaluation using explicit expressions.
IQR, signature(x = "Dirac"):exact evaluation using explicit expressions.
IQR, signature(x = "DExp"):exact evaluation using explicit expressions.
IQR, signature(x = "Exp"):exact evaluation using explicit expressions.
IQR, signature(x = "Geom"):exact evaluation using explicit expressions.
IQR, signature(x = "Logis"):exact evaluation using explicit expressions.
IQR, signature(x = "Norm"):exact evaluation using explicit expressions.
IQR, signature(x = "Unif"):exact evaluation using explicit expressions.
median, signature(x = "Arcsine"):exact evaluation using explicit expressions.
median, signature(x = "Cauchy"):exact evaluation using explicit expressions.
median, signature(x = "Dirac"):exact evaluation using explicit expressions.
median, signature(x = "DExp"):exact evaluation using explicit expressions.
median, signature(x = "Exp"):exact evaluation using explicit expressions.
median, signature(x = "Geom"):exact evaluation using explicit expressions.
median, signature(x = "Logis"):exact evaluation using explicit expressions.
median, signature(x = "Lnorm"):exact evaluation using explicit expressions.
median, signature(x = "Norm"):exact evaluation using explicit expressions.
median, signature(x = "Unif"):exact evaluation using explicit expressions.
mad, signature(x = "Arcsine"):exact evaluation using explicit expressions.
mad, signature(x = "Cauchy"):exact evaluation using explicit expressions.
mad, signature(x = "Dirac"):exact evaluation using explicit expressions.
mad, signature(x = "DExp"):exact evaluation using explicit expressions.
mad, signature(x = "Exp"):exact evaluation using explicit expressions.
mad, signature(x = "Geom"):exact evaluation using explicit expressions.
mad, signature(x = "Logis"):exact evaluation using explicit expressions.
mad, signature(x = "Norm"):exact evaluation using explicit expressions.
mad, signature(x = "Unif"):exact evaluation using explicit expressions.
skewness, signature(x = "Arcsine"):exact evaluation using explicit expressions.
skewness, signature(x = "Beta"):for noncentrality 0 exact evaluation using explicit expressions.
skewness, signature(x = "Binom"):exact evaluation using explicit expressions.
skewness, signature(x = "Cauchy"):exact evaluation using explicit expressions.
skewness, signature(x = "Chisq"):exact evaluation using explicit expressions.
skewness, signature(x = "Dirac"):exact evaluation using explicit expressions.
skewness, signature(x = "DExp"):exact evaluation using explicit expressions.
skewness, signature(x = "Exp"):exact evaluation using explicit expressions.
skewness, signature(x = "Fd"):exact evaluation using explicit expressions.
skewness, signature(x = "Gammad"):exact evaluation using explicit expressions.
skewness, signature(x = "Geom"):exact evaluation using explicit expressions.
skewness, signature(x = "Hyper"):exact evaluation using explicit expressions.
skewness, signature(x = "Logis"):exact evaluation using explicit expressions.
skewness, signature(x = "Lnorm"):exact evaluation using explicit expressions.
skewness, signature(x = "Nbinom"):exact evaluation using explicit expressions.
skewness, signature(x = "Norm"):exact evaluation using explicit expressions.
skewness, signature(x = "Pois"):exact evaluation using explicit expressions.
skewness, signature(x = "Td"):exact evaluation using explicit expressions.
skewness, signature(x = "Unif"):exact evaluation using explicit expressions.
skewness, signature(x = "Weibull"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Arcsine"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Beta"):for noncentrality 0 exact evaluation using explicit expressions.
kurtosis, signature(x = "Binom"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Cauchy"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Chisq"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Dirac"):exact evaluation using explicit expressions.
kurtosis, signature(x = "DExp"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Exp"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Fd"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Gammad"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Geom"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Hyper"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Logis"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Lnorm"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Nbinom"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Norm"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Pois"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Td"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Unif"):exact evaluation using explicit expressions.
kurtosis, signature(x = "Weibull"):exact evaluation using explicit expressions.
If any of the packages e1071, moments, fBasics is to be used together with distrEx
the latter must be attached after any of the first mentioned. Otherwise kurtosis() and skewness()
defined as methods in distrEx may get masked.
To re-mask, you may use
kurtosis <- distrEx::kurtosis; skewness <- distrEx::skewness.
See also distrExMASK().
G. Jay Kerns, [email protected], has provided a major contribution,
in particular the functionals skewness and kurtosis are due to him.
Peter Ruckdeschel [email protected]
distrExIntegrate, m1df, m2df,
Distribution-class,sd, var, IQR,median, mad, sd,Sn, Qn
# Variance of Exp(1) distribution var(Exp()) #median(Exp()) IQR(Exp()) mad(Exp()) # Variance of N(1,4)^2 var(Norm(mean=1, sd=2), fun = function(x){x^2}) var(Norm(mean=1, sd=2), fun = function(x){x^2}, useApply = FALSE) ## sd -- may equivalently be replaced by var sd(Pois()) ## uses explicit terms sd(as(Pois(),"DiscreteDistribution")) ## uses sums sd(as(Pois(),"UnivariateDistribution")) ## uses simulations sd(Norm(mean=2), fun = function(x){2*x^2}) ## uses simulations # mad(sin(exp(Norm()+2*Pois()))) ## weird# Variance of Exp(1) distribution var(Exp()) #median(Exp()) IQR(Exp()) mad(Exp()) # Variance of N(1,4)^2 var(Norm(mean=1, sd=2), fun = function(x){x^2}) var(Norm(mean=1, sd=2), fun = function(x){x^2}, useApply = FALSE) ## sd -- may equivalently be replaced by var sd(Pois()) ## uses explicit terms sd(as(Pois(),"DiscreteDistribution")) ## uses sums sd(as(Pois(),"UnivariateDistribution")) ## uses simulations sd(Norm(mean=2), fun = function(x){2*x^2}) ## uses simulations # mad(sin(exp(Norm()+2*Pois()))) ## weird