This decorator adds numeric methods for missing analytic expression in distr6 Distribution objects as well as adding generalised expectation and moments functions.
Returns a decorated R6 object inheriting from class SDistribution with the methods listed below added to the SDistribution methods.
CoreStatistics$new(distribution)
Argument | Type | Details |
distribution |
distribution | Distribution to decorate. |
Method | Name | Link |
mgf(t) |
Moment generating function | mgf |
pgf(t) |
Probability generating function | pgf |
cf(t) |
Characteristic function | cf |
entropy(base = 2) |
(Shannon) Entropy | entropy |
skewness() |
Skewness | skewness |
kurtosis(excess = TRUE) |
Kurtosis | kurtosis |
kthmoment(type = "central") |
Kth Moment | kthmoment |
genExp(trafo) |
Generalised Expectation | genExp |
mode(which = "all") |
Mode | mode |
variance() |
Variance | variance |
mean() |
Arithmetic mean | mean.Distribution |
Decorator objects add functionality to the given Distribution object by copying methods in the decorator environment to the chosen Distribution environment. See the 'Added Methods' section below to find details of the methods that are added to the Distribution. Methods already present in the distribution are not overwritten by the decorator.
Use decorate
to decorate a Distribution.
All methods in this decorator use numerical approximations and therefore better results may be available from analytic computations.
# NOT RUN {
x = Binomial$new()
decorate(x, CoreStatistics)
x$genExp()
x = Binomial$new(decorators = CoreStatistics)
x$kthmoment(4)
# }
Run the code above in your browser using DataLab