distrEx (version 2.0.5)

var: Generic Functions for the Computation of Functionals

Description

Generic functions for the computation of functionals on distributions.

Usage

IQR(x, ...)

## S3 method for class 'UnivariateDistribution':
IQR(x)
## S3 method for class 'AffLinDistribution':
IQR(x)
## S3 method for class 'DiscreteDistribution':
IQR(x)
## S3 method for class 'Cauchy':
IQR(x)
## S3 method for class 'Dirac':
IQR(x)
## S3 method for class 'DExp':
IQR(x)
## S3 method for class 'Exp':
IQR(x)
## S3 method for class 'Geom':
IQR(x)
## S3 method for class 'Logis':
IQR(x)
## S3 method for class 'Norm':
IQR(x)
## S3 method for class 'Unif':
IQR(x)
## S3 method for class 'Arcsine':
IQR(x)

median(x, ...)

## S3 method for class 'UnivariateDistribution':
median(x)
## S3 method for class 'AffLinDistribution':
median(x)
## S3 method for class 'Cauchy':
median(x)
## S3 method for class 'Dirac':
median(x)
## S3 method for class 'DExp':
median(x)
## S3 method for class 'Exp':
median(x)
## S3 method for class 'Geom':
median(x)
## S3 method for class 'Logis':
median(x)
## S3 method for class 'Lnorm':
median(x)
## S3 method for class 'Norm':
median(x)
## S3 method for class 'Unif':
median(x)
## S3 method for class 'Arcsine':
median(x)

mad(x, ...)

## S3 method for class 'UnivariateDistribution':
mad(x)
## S3 method for class 'AffLinDistribution':
mad(x)
## S3 method for class 'Cauchy':
mad(x)
## S3 method for class 'Dirac':
mad(x)
## S3 method for class 'DExp':
mad(x)
## S3 method for class 'Exp':
mad(x)
## S3 method for class 'Geom':
mad(x)
## S3 method for class 'Logis':
mad(x)
## S3 method for class 'Norm':
mad(x)
## S3 method for class 'Unif':
mad(x)
## S3 method for class 'Arcsine':
mad(x)

sd(x, ...)

## S3 method for class 'UnivariateDistribution':
sd(x, fun, cond, withCond, useApply, ...)
## S3 method for class 'Norm':
sd(x, fun, cond, withCond = FALSE, useApply = TRUE, ...)

var(x, ...)

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

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

kurtosis(x, ...)
## S3 method for class 'UnivariateDistribution':
kurtosis(x, fun, cond, withCond, useApply, ...)
## S3 method for class 'AffLinDistribution':
kurtosis(x, fun, cond, withCond, useApply, ...)
## S3 method for class 'Binom':
kurtosis(x, ...)
## S3 method for class 'Beta':
kurtosis(x, ...)
## S3 method for class 'Cauchy':
kurtosis(x, ...)
## S3 method for class 'Chisq':
kurtosis(x, ...)
## S3 method for class 'Dirac':
kurtosis(x, ...)
## S3 method for class 'DExp':
kurtosis(x, ...)
## S3 method for class 'Exp':
kurtosis(x, ...)
## S3 method for class 'Fd':
kurtosis(x, ...)
## S3 method for class 'Gammad':
kurtosis(x, ...)
## S3 method for class 'Geom':
kurtosis(x, ...)
## S3 method for class 'Hyper':
kurtosis(x, ...)
## S3 method for class 'Logis':
kurtosis(x, ...)
## S3 method for class 'Lnorm':
kurtosis(x, ...)
## S3 method for class 'Nbinom':
kurtosis(x, ...)
## S3 method for class 'Norm':
kurtosis(x, ...)
## S3 method for class 'Pois':
kurtosis(x, ...)
## S3 method for class 'Td':
kurtosis(x, ...)
## S3 method for class 'Unif':
kurtosis(x, ...)
## S3 method for class 'Weibull':
kurtosis(x, ...)
## S3 method for class 'Arcsine':
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.

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.

concept

  • functional
  • var
  • sd
  • IQR
  • mad
  • median
  • skewness
  • kurtosis
  • integration

See Also

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

Examples

Run this code
# 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

Run the code above in your browser using DataCamp Workspace