class %DeepSee.extensions.stat.MixedDistribution
extends %RegisteredObject, AbstractContinuousDistribution
Represents multicomponent continues distribution. For example let the
user to create a distribution consisting of mixed Gaussian components or
a mixed Normal/Exponential distribution.
Here is an example of it's usage:
set ndist = ##class(%DeepSee.extensions.stat.NormalDistribution).create(m, (sigma * sigma))
set edist = ##class(%DeepSee.extensions.stat.ExpDistribution).create(lambda)
set mdist = ##class(%DeepSee.extensions.stat.MixedDistribution).%New()
set sc = mdist.AddComponent(ndist, w)
Quit:$$$ISERR(sc)
set sc = mdist.AddComponent(edist, (1-w))
Quit:$$$ISERR(sc)
set sc = mdist.balance()
Quit:$$$ISERR(sc)
w "Mean = "_mdist.Mean
w "; Var = "_mdist.Variance
w "; Entropy = "_mdist.Entropy, !
method AddComponent(p As AbstractContinuousDistribution, weight As %Double)
as %Status
Add a component p to the distribution with the given weight. After all components
are added application must call balance
method balance()
as %Status
The method to call after all components of the distribution are specified.
method cdf(x1 As %Double, x2 As %Double = "")
as %Double
An interface method for cumulative distribution function (CDF). Optionally provides a cumulative probability
of a value being between two values x1 and x2.
If called with 1 argument(x1) or if the value of second argument is empty string then
returns CDF value for x1. If called with two arguments, x1 and x2 then returns
a probability of a value being between x1 and x2.
method pdf(x As %Double)
as %Double
An interface method for probability distribution function (PDF).
Returns PDF value for x.