Var: Generic Functions for the Computation of Functionals

varR Documentation

Generic Functions for the Computation of Functionals

Description

Generic functions for the computation of functionals on distributions.

Usage

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"), ...)

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.

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 distrExoption propagate.names.functionals.

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.

Author(s)

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

See Also

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

Examples

# 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

distrEx documentation built on Jan. 30, 2024, 3:01 a.m.

Related to Var in distrEx...