IMSL C# Numerical Library

Random.NextExponentialMix Method 

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

public virtual double NextExponentialMix(
   double theta1,
   double theta2,
   double p
);

Parameters

theta1
A double which specifies the mean of the exponential distribution that has the larger mean.
theta2
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
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

Random Class | Imsl.Stat Namespace | Example