Generate a pseudorandom number from a mixture of two exponential
distributions.
Namespace:
Imsl.StatAssembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
public virtual double NextExponentialMix( double theta1, double theta2, double p ) |
Visual Basic (Declaration) |
---|
Public Overridable Function NextExponentialMix ( _ theta1 As Double, _ theta2 As Double, _ p As Double _ ) As Double |
Visual C++ |
---|
public: virtual double NextExponentialMix( double theta1, double theta2, double p ) |
Parameters
- theta1
- Type: System..::.Double
A double which specifies the mean of the exponential distribution that has the larger mean.
- theta2
- Type: System..::.Double
A double which specifies the mean of the exponential distribution that has the smaller mean. theta2 must be positive and less than or equal to theta1.
- p
- Type: System..::.Double
A double which specifies the mixing parameter. It must satisfy .
Return Value
A double which specifies a pseudorandom number from a mixture of the two exponential distributions.Remarks
The probability density function is
where , , and .
In the case of a convex mixture, that is, the case , the mixing parameter p is interpretable as a probability; and NextExponentialMix with probability p generates an exponential deviate with mean , and with probability 1 - p generates an exponential with mean . When p is greater than 1, but less than , then either an exponential deviate with mean or the sum of two exponentials with means and is generated. The probabilities are and 1 - q, respectively, for the single exponential and the sum of the two exponentials.