| expectation | R Documentation |
Computes expectations from reference measures
expectation(measure, f, ..., method)
## S3 method for class 'ReferenceMeasure'
expectation(
measure,
f,
...,
method = c("default", "sample", "MonteCarlo", "integration"),
tol = 0.01
)
## S3 method for class 'ReferenceMeasureDiscrete'
expectation(measure, f, ..., method = c("sample"))
measure |
the (probability) measure to compute the expectation from |
f |
a real valued random variable, represented as a vectorized function, for which the expectation shall be computed. |
... |
further arguments to f or the method used |
method |
a method to be selected. Typical methods are "sample", "MonteCarlo" and "integrate", but only sample is availabel for all reference measures. "sample" uses the prestored sample, "MonteCarlo" uses the simulated function of the reference measure, and "integrate" uses numerical integration. Typically the prestored integration sample performs well with derivatives measures derived ReferenceMeasureUniform, ReferenceMeasusureTransformed, where it proves a dense grid in the area of measure, and ReferenceMeasure discrete where it uses precise computation using a weighted sample. For Cartesian products involving more than one continues measure due to the curse of dimensionality typically only MonteCarlo is expected to work reasonably well. |
tol |
the absolute or relative tolerance (whichever is larger). accepted for methods with tolerance control. |
the numerically computed expected value of f with respect to the measure. The method
expectation(ReferenceMeasure): general method supporting only the "sample"
method.
expectation(ReferenceMeasureDiscrete): a computing the results explicitly
Other ReferenceMeasures:
B2N01,
ReferenceMeasureDiscrete(),
ReferenceMeasureTransformed(),
ReferenceMeasureUniform(),
StdReferenceMeasureUnif01,
getSample(),
isInDomain()
m <- ReferenceMeasureUniform(0,10)
expectation(m, function(x) x^2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.