E(object, fun, cond, ...)
"E"(object, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...)
"E"(object, fun, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...)
"E"(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"E"(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"E"(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"E"(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"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"), ...)
"E"(object, fun, useApply = TRUE, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, Nsim = getdistrExOption("MCIterations"), ...)
"E"(object, fun, useApply = TRUE, Nsim = getdistrExOption("MCIterations"), ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, fun, useApply = TRUE, ...)
"E"(object, cond, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"E"(object, cond, useApply = TRUE, low = NULL, upp = NULL, ...)
"E"(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL, Nsim = getdistrExOption("MCIterations"), ...)
"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") , ...)
"E"(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...)
"E"(object, fun, cond, withCond = FALSE, useApply = TRUE, low = NULL, upp = NULL,...)
"E"(object, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ... )
"E"(object, fun, useApply = TRUE, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ... )
"E"(object, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ... )
"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"), ... )
"E"(object, fun, cond, low = NULL, upp = NULL, rel.tol= getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ... )
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = getdistrExOption("IQR.fac"), ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, fun, low = NULL, upp = NULL, rel.tol = getdistrExOption("ErelativeTolerance"), lowerTruncQuantile = getdistrExOption("ElowerTruncQuantile"), upperTruncQuantile = getdistrExOption("EupperTruncQuantile"), IQR.fac = max(10000, getdistrExOption("IQR.fac")), ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"E"(object, low = NULL, upp = NULL, ...)
"Distribution"
fun
is computed. cond
is computed. distrExIntegrate
.IQR.fac
$*$IQR).fun
sapply
, respectively apply
be used to evaluate fun
. cond
in the argument list of fun
. distrExIntegrate
. support
and sum
.support
and sum
.X
either "DiscreteDistribution"
or "AbscontDistribution"
.
X
either "UnivarLebDecDistribution"
.
fun
under univariate distributions using
crude Monte-Carlo integration. fun
under univariate Lebesgue decomposed distributions
by separate calculations for discrete and absolutely continuous part. fun
under absolutely continuous
univariate distributions using distrExIntegrate
. fun
under discrete univariate
distributions using support
and sum
. fun
under discrete multivariate
distributions. The computation is based on support
and sum
. cond
.
The integral is computed using crude Monte-Carlo integration. cond
. The computation
is based on distrExIntegrate
. cond
. The computation is based
on support
and sum
. fun
under univariate conditional distributions
given cond
. The integral is computed using crude Monte-Carlo integration. fun
under absolutely continuous,
univariate conditional distributions given cond
. The
computation is based on distrExIntegrate
. fun
under discrete, univariate
conditional distributions given cond
. The computation is
based on support
and sum
. mixCoeff
.mixCoeff
.mixCoeff
.mixCoeff
."UnivarLebDecDistribution"
and using the corresponding method.
SummandsDistr
is of
class UnivariateDistribution
) the formula
$E[N]E[S]$ for $N$ the frequency distribution and
$S$ the summand distribution; else we coerce to
"UnivarLebDecDistribution"
.
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.=>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)
Run the code above in your browser using DataLab