pdfexp, cdfExp

User Forumpdfexp, cdfExp
mauriciosalsa asked 2 years ago

i´m lost in the use of pdfExp(x,a,m), cdfExp(x,a,m). Given that the exponential is iqual to:

 f(x;\lambda) = \begin{cases}
\lambda e^{-\lambda x} & x \ge 0, \\
0 & x < 0.

What are the location and mean parameter?

For the cdfexp you said that it´s iqual to:


I don´t see any m there?

How can I have the same values than Matlab whith his expcdf and exppdf functions?

Thank you.

1 Answers
aptech Staff answered 2 years ago

The pdfExp and cdfExp in GAUSS calculate the two parameter exponential function. This is documented more clearly and accurately in the latest version of GAUSS.

For easy comparison, I will show a few different parameterizations in GAUSS code. First, the single-parameter exponential function with a rate parameter called lambda. This is the one which you posted above.

val = lambda * exp(-lambda * x);

Second, the single-parameter exponential function with a scale parameter beta. This scale parameter is the reciprocal of the rate parameter.

val = (1/beta) * exp(-x/beta);

Finally, the two-parameter exponential function with a scale parameter beta and a threshold parameter (or location parameter in a sense) theta. This is the function in GAUSS.

val = (1/beta) * exp(-(x - theta)/beta));

To calculate the single-parameter exponential function in GAUSS, you will always set the second input equal to 0. If you are thinking of the distribution in terms of the rate parameter, lambda then you will pass in the final value as the 1/lambda. Here are some examples:

//x = 1.2, lambda = 0.5
val_1 = 0.5 * exp(-1.2*0.5);

//x = 1.2, beta = 2
val_2 = 1/2 * exp(-1.2/2);

//x = 1.2, beta = 2, theta = 0
val_3 = 1/2 * exp(-(1.2 - 0)/2);

//x = 1.2, beta = 2, theta = 0
val_4 = pdfExp(1.2, 0, 2);

For each of these the answer should be: 0.27440582.