var

0th

Percentile

Generic Functions for the Computation of Functionals

Generic functions for the computation of functionals on distributions.

Keywords
methods, distribution
Usage
IQR(x, ...)

# S4 method for UnivariateDistribution IQR(x) # S4 method for UnivariateCondDistribution IQR(x,cond) # S4 method for AffLinDistribution IQR(x) # S4 method for DiscreteDistribution IQR(x) # S4 method for Arcsine IQR(x) # S4 method for Cauchy IQR(x) # S4 method for Dirac IQR(x) # S4 method for DExp IQR(x) # S4 method for Exp IQR(x) # S4 method for Geom IQR(x) # S4 method for Logis IQR(x) # S4 method for Norm IQR(x) # S4 method for Unif IQR(x)

median(x, ...)

# S4 method for UnivariateDistribution median(x) # S4 method for UnivariateCondDistribution median(x,cond) # S4 method for AffLinDistribution median(x) # S4 method for Arcsine median(x) # S4 method for Cauchy median(x) # S4 method for Dirac median(x) # S4 method for DExp median(x) # S4 method for Exp median(x) # S4 method for Geom median(x) # S4 method for Logis median(x) # S4 method for Lnorm median(x) # S4 method for Norm median(x) # S4 method for Unif median(x)

mad(x, ...)

# S4 method for UnivariateDistribution mad(x) # S4 method for AffLinDistribution mad(x) # S4 method for Cauchy mad(x) # S4 method for Dirac mad(x) # S4 method for DExp mad(x) # S4 method for Exp mad(x) # S4 method for Geom mad(x) # S4 method for Logis mad(x) # S4 method for Norm mad(x) # S4 method for Unif mad(x) # S4 method for Arcsine mad(x)

sd(x, ...)

# S4 method for UnivariateDistribution sd(x, fun, cond, withCond, useApply, ...) # S4 method for Norm sd(x, fun, cond, withCond = FALSE, useApply = TRUE, ...)

var(x, ...)

# S4 method for UnivariateDistribution var(x, fun, cond, withCond, useApply, ...) # S4 method for AffLinDistribution var(x, fun, cond, withCond, useApply, ...) # S4 method for CompoundDistribution var(x, ...) # S4 method for Arcsine var(x, ...) # S4 method for Binom var(x, ...) # S4 method for Beta var(x, ...) # S4 method for Cauchy var(x, ...) # S4 method for Chisq var(x, ...) # S4 method for Dirac var(x, ...) # S4 method for DExp var(x, ...) # S4 method for Exp var(x, ...) # S4 method for Fd var(x, ...) # S4 method for Gammad var(x, ...) # S4 method for Geom var(x, ...) # S4 method for Hyper var(x, ...) # S4 method for Logis var(x, ...) # S4 method for Lnorm var(x, ...) # S4 method for Nbinom var(x, ...) # S4 method for Norm var(x, ...) # S4 method for Pois var(x, ...) # S4 method for Td var(x, ...) # S4 method for Unif var(x, ...) # S4 method for Weibull var(x, ...)

skewness(x, ...) # S4 method for UnivariateDistribution skewness(x, fun, cond, withCond, useApply, ...) # S4 method for AffLinDistribution skewness(x, fun, cond, withCond, useApply, ...) # S4 method for Arcsine skewness(x, ...) # S4 method for Binom skewness(x, ...) # S4 method for Beta skewness(x, ...) # S4 method for Cauchy skewness(x, ...) # S4 method for Chisq skewness(x, ...) # S4 method for Dirac skewness(x, ...) # S4 method for DExp skewness(x, ...) # S4 method for Exp skewness(x, ...) # S4 method for Fd skewness(x, ...) # S4 method for Gammad skewness(x, ...) # S4 method for Geom skewness(x, ...) # S4 method for Hyper skewness(x, ...) # S4 method for Logis skewness(x, ...) # S4 method for Lnorm skewness(x, ...) # S4 method for Nbinom skewness(x, ...) # S4 method for Norm skewness(x, ...) # S4 method for Pois skewness(x, ...) # S4 method for Td skewness(x, ...) # S4 method for Unif skewness(x, ...) # S4 method for Weibull skewness(x, ...)

kurtosis(x, ...) # S4 method for UnivariateDistribution kurtosis(x, fun, cond, withCond, useApply, ...) # S4 method for AffLinDistribution kurtosis(x, fun, cond, withCond, useApply, ...) # S4 method for Arcsine kurtosis(x, ...) # S4 method for Binom kurtosis(x, ...) # S4 method for Beta kurtosis(x, ...) # S4 method for Cauchy kurtosis(x, ...) # S4 method for Chisq kurtosis(x, ...) # S4 method for Dirac kurtosis(x, ...) # S4 method for DExp kurtosis(x, ...) # S4 method for Exp kurtosis(x, ...) # S4 method for Fd kurtosis(x, ...) # S4 method for Gammad kurtosis(x, ...) # S4 method for Geom kurtosis(x, ...) # S4 method for Hyper kurtosis(x, ...) # S4 method for Logis kurtosis(x, ...) # S4 method for Lnorm kurtosis(x, ...) # S4 method for Nbinom kurtosis(x, ...) # S4 method for Norm kurtosis(x, ...) # S4 method for Pois kurtosis(x, ...) # S4 method for Td kurtosis(x, ...) # S4 method for Unif kurtosis(x, ...) # S4 method for Weibull kurtosis(x, ...)

Arguments
x

object of class "UnivariateDistribution"

fun

if missing the (conditional) variance resp. standard deviation is computed else the (conditional) variance resp. standard deviation of fun is computed.

cond

if not missing the conditional variance resp. standard deviation given cond is computed.

additional arguments to fun or E

useApply

logical: should sapply, respectively apply be used to evaluate fund.

withCond

logical: is cond in the argument list of fun.

Value

The value of the corresponding functional at the distribution in the argument is computed.

Methods

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 \({\rm E}[N]{\rm var}[S]+({\rm E}[S]^2+{\rm var}(S)){\rm var}(N)\) for \(N\) the frequency distribution and \(S\) 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.

Caveat

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().

Acknowledgement

G. Jay Kerns, gkerns@ysu.edu, has provided a major contribution, in particular the functionals skewness and kurtosis are due to him.

See Also

distrExIntegrate, m1df, m2df, Distribution-class, sd, var, IQR, median, mad, sd, Sn, Qn

Aliases
  • var
  • var-methods
  • var,ANY-method
  • var,UnivariateDistribution-method
  • var,AffLinDistribution-method
  • var,AffLinAbscontDistribution-method
  • var,AffLinDiscreteDistribution-method
  • var,AffLinLatticeDistribution-method
  • var,CompoundDistribution-method
  • var,Arcsine-method
  • var,Beta-method
  • var,Binom-method
  • var,Cauchy-method
  • var,Chisq-method
  • var,Dirac-method
  • var,DExp-method
  • var,Exp-method
  • var,Fd-method
  • var,Gammad-method
  • var,Geom-method
  • var,Hyper-method
  • var,Logis-method
  • var,Lnorm-method
  • var,Nbinom-method
  • var,Norm-method
  • var,Pois-method
  • var,Unif-method
  • var,Weibull-method
  • var,Td-method
  • sd
  • sd-methods
  • sd,UnivariateDistribution-method
  • sd,Norm-method
  • median
  • median,ANY-method
  • median-methods
  • median,UnivariateDistribution-method
  • median,UnivariateCondDistribution-method
  • median,AffLinDistribution-method
  • median,AffLinAbscontDistribution-method
  • median,AffLinDiscreteDistribution-method
  • median,AffLinLatticeDistribution-method
  • median,Arcsine-method
  • median,Cauchy-method
  • median,Dirac-method
  • median,DExp-method
  • median,Exp-method
  • median,Geom-method
  • median,Logis-method
  • median,Lnorm-method
  • median,Norm-method
  • median,Unif-method
  • IQR
  • IQR-methods
  • IQR,ANY-method
  • IQR,UnivariateDistribution-method
  • IQR,UnivariateCondDistribution-method
  • IQR,AffLinDistribution-method
  • IQR,AffLinAbscontDistribution-method
  • IQR,AffLinDiscreteDistribution-method
  • IQR,AffLinLatticeDistribution-method
  • IQR,DiscreteDistribution-method
  • IQR,Arcsine-method
  • IQR,Cauchy-method
  • IQR,Dirac-method
  • IQR,DExp-method
  • IQR,Exp-method
  • IQR,Geom-method
  • IQR,Logis-method
  • IQR,Norm-method
  • IQR,Unif-method
  • mad
  • mad,ANY-method
  • mad-methods
  • mad,UnivariateDistribution-method
  • mad,AffLinDistribution-method
  • mad,AffLinAbscontDistribution-method
  • mad,AffLinDiscreteDistribution-method
  • mad,AffLinLatticeDistribution-method
  • mad,Cauchy-method
  • mad,Dirac-method
  • mad,DExp-method
  • mad,Exp-method
  • mad,Geom-method
  • mad,Logis-method
  • mad,Norm-method
  • mad,Unif-method
  • mad,Arcsine-method
  • skewness
  • skewness-methods
  • skewness,ANY-method
  • skewness,UnivariateDistribution-method
  • skewness,AffLinDistribution-method
  • skewness,AffLinAbscontDistribution-method
  • skewness,AffLinDiscreteDistribution-method
  • skewness,AffLinLatticeDistribution-method
  • skewness,Arcsine-method
  • skewness,Beta-method
  • skewness,Binom-method
  • skewness,Cauchy-method
  • skewness,Chisq-method
  • skewness,Dirac-method
  • skewness,DExp-method
  • skewness,Exp-method
  • skewness,Fd-method
  • skewness,Gammad-method
  • skewness,Geom-method
  • skewness,Hyper-method
  • skewness,Logis-method
  • skewness,Lnorm-method
  • skewness,Nbinom-method
  • skewness,Norm-method
  • skewness,Pois-method
  • skewness,Unif-method
  • skewness,Weibull-method
  • skewness,Td-method
  • kurtosis
  • kurtosis-methods
  • kurtosis,ANY-method
  • kurtosis,UnivariateDistribution-method
  • kurtosis,AffLinDistribution-method
  • kurtosis,AffLinAbscontDistribution-method
  • kurtosis,AffLinDiscreteDistribution-method
  • kurtosis,AffLinLatticeDistribution-method
  • kurtosis,Arcsine-method
  • kurtosis,Beta-method
  • kurtosis,Binom-method
  • kurtosis,Cauchy-method
  • kurtosis,Chisq-method
  • kurtosis,Dirac-method
  • kurtosis,DExp-method
  • kurtosis,Exp-method
  • kurtosis,Fd-method
  • kurtosis,Gammad-method
  • kurtosis,Geom-method
  • kurtosis,Hyper-method
  • kurtosis,Logis-method
  • kurtosis,Lnorm-method
  • kurtosis,Nbinom-method
  • kurtosis,Norm-method
  • kurtosis,Pois-method
  • kurtosis,Unif-method
  • kurtosis,Weibull-method
  • kurtosis,Td-method
Examples
# NOT RUN {
# 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
# }
Documentation reproduced from package distrEx, version 2.8.0, License: LGPL-3

Community examples

Looks like there are no examples yet.