Learn R Programming

distr6 (version 1.1.0)

FunctionImputation: Imputed Pdf/Cdf/Quantile/Rand Functions

Description

This decorator imputes missing pdf/cdf/quantile/rand methods from R6 Distributions by using strategies dependent on which methods are already present in the distribution.

Value

Returns a decorated R6 object inheriting from class SDistribution with d/p/q/r numerically imputed if previously missing.

Constructor

FunctionImputation$new(distribution)

Constructor Arguments

Argument Type Details
distribution distribution Distribution to decorate.

Added Methods

Method Name Link
pdf(x1, ..., log = FALSE, simplify = TRUE) Density/mass function pdf
cdf(x1, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE) Distribution function cdf
quantile(p, ..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE) Quantile function quantile.Distribution
rand(n, simplify = TRUE) Simulation function rand

Details

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.

See Also

decorate, listDecorators

Examples

Run this code
# NOT RUN {
x = Distribution$new("Test", pdf = function(x) 1/(4-1),
support = Interval$new(1,4),
type = Reals$new())
decorate(x, FunctionImputation)
plot(x$pdf(0:5))
plot(x$cdf(0:5))

x = Distribution$new("Test", pdf = function(x) 1/(4-1),
decorators = ExoticStatistics)
x$cdf(1)
# }

Run the code above in your browser using DataLab