Generate a pseudorandom number from a mixture of two exponential distributions.

Namespace: Imsl.Stat
Assembly: 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 0 \le p \le {\rm {theta1/(theta1-theta2)}}.

Return Value

A double which specifies a pseudorandom number from a mixture of the two exponential distributions.

Remarks

The probability density function is

f\left( x \right) = \frac{p}{\theta }e^{ - 
            x/\theta _1 }  + \frac{{1 - p}}{{\theta _2 }}e^{ - x/\theta _2 } 
            \,\,\, for\,x \gt 0

where p = \rm p, \theta_1 = 
            theta1, and \theta_2 = theta2.

In the case of a convex mixture, that is, the case 0 \lt p 
            \lt 1, the mixing parameter p is interpretable as a probability; and NextExponentialMix with probability p generates an exponential deviate with mean \theta_1, and with probability 1 - p generates an exponential with mean \theta_2. When p is greater than 1, but less than \theta_1/(\theta_1 - \theta_2), then either an exponential deviate with mean \theta_2 or the sum of two exponentials with means \theta_1 and \theta_2 is generated. The probabilities are q = p - (p -1) \theta_1 /\theta_2 and 1 - q, respectively, for the single exponential and the sum of the two exponentials.

See Also