variance: Computes the approximate variance of a loss distribution.

View source: R/variance.R

varianceR Documentation

Computes the approximate variance of a loss distribution.

Description

The computation is based on Steiner's theorem \textrm{var}(X) = \textrm{E}(X^2) - (\textrm{E}(X))^2, where the respective first and second moments are computed using the moment function (from this package). Internally, these functions operate on the approximate kernel density estimation for both, continuous and categorical distributions (see the lossDistribution function for details).

Usage

variance(x)

Arguments

x

an object of class mosg.lossDistribution

Value

the approximate variance value

Note

the function works on the internal probability mass function (which may be different from the empirical distribution in case that the loss distribution has been smoothed during its construction; see lossDistribution). The function delivers only an approximate variance, whose error is due to numeric roundoff errors (known to occur in Steiner's formula), and the fact that the computation is done on an approximate density (rather than the empirical distribution).

Author(s)

Stefan Rass

See Also

moment, lossDistribution

Examples












x <- c(10,6.4,9,7.9,7.1,9)
ld <- lossDistribution(x)
variance(ld)
var(x)

HyRiM documentation built on Dec. 9, 2022, 1:08 a.m.