Convolution | R Documentation |
Calculates the convolution of two distribution via numerical calculations.
## S3 method for class 'Distribution' x + y ## S3 method for class 'Distribution' x - y
x, y |
Distribution |
The convolution of two probability distributions X, Y is the sum
Z = X + Y
which has a pmf,
P(Z = z) = ∑_x P(X = x)P(Y = z - x)
with an integration analogue for continuous distributions.
Currently distr6 supports the addition of discrete and continuous probability distributions, but only subtraction of continuous distributions.
Returns an R6 object of class Convolution.
distr6::Distribution
-> distr6::DistributionWrapper
-> Convolution
new()
Creates a new instance of this R6 class.
Convolution$new(dist1, dist2, add = TRUE)
dist1
([Distribution])
First Distribution in convolution, i.e. dist1 ± dist2
.
dist2
([Distribution])
Second Distribution in convolution, i.e. dist1 ± dist2
.
add
(logical(1))
If TRUE
(default) then adds the distributions together, otherwise substracts.
clone()
The objects of this class are cloneable with this method.
Convolution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other wrappers:
DistributionWrapper
,
HuberizedDistribution
,
MixtureDistribution
,
ProductDistribution
,
TruncatedDistribution
,
VectorDistribution
binom <- Bernoulli$new() + Bernoulli$new() binom$pdf(2) Binomial$new(size = 2)$pdf(2) norm <- Normal$new(mean = 3) - Normal$new(mean = 2) norm$pdf(1) Normal$new(mean = 1, var = 2)$pdf(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.