IV. Triangular Distribution

[Pages:3]IV. Triangular Distribution

Known values are the minimum (a), the mode (b - the most likely value of the pdf), and the maximum (c).

probability density function (area under the curve = 1)

f(x) h= 2 c-a

ab

c

x

The pdf is given by

2(x - a) f(x) = (c--2a()x(b--ca))

(c - a)(c - b)

for a x b (slope = h ) b-a

for b x c (slope = - h ) c-b

= 0

otherwise

The expected value is given by

b

E(X) = x f(x)dx =

2(x - a)

c

xdx +

2(c - x)

xdx = a + b + c

-

(c - a)(b - a)

a

(c - a)(c - b)

b

3

The derivation is fairly tedious; with a little work it can be shown that

E(X)

=

h

2b3

- 3ab 2 + a3 6(b - a)

+

c 3

- 3cb 2 + 2b3

6(c - b)

=

a 3 (c - b) + b3 (a - c) + c3 (b - a) 3(c - a)(b - a)(c - b)

= (a + b + c)(c - a)(b - a)(c - b) = a + b + c

3(c - a)(b - a)(c - b)

3

Remark:

For a discrete sample, measures of centrality that are typically determined are the mean, the mode, and the median. The mean is the average value of the sample and corresponds to E(X). The mode corresponds to the maximum value of the pdf. When working with a sample, it is necessary to resort to a histogram (which can be tricky) to estimate the mode of the underlying pdf. The median simply corresponds to that point at which half of the area under the curve is to the left and half is to the right. The triangular distribution is typically employed when not much is known about the distribution, but the minimum, mode, and maximum can be estimated.

Sampling from the triangular distribution requires solving

rsample

x = f(z)dz -

for rsample given random probability x.

Since f(z) is piecewise continuous, its distribution function F(t) is given by

0 for t a

t

F(t) =

t

f(z)dz

f(z)dz

= a c

for a < t b

-

1 -

f(z)dx

for b t < c

t

1

for t c

Hence, for a rsample b we get

A

rsample

rsample

x =

f(z)dz =

2(z - a)

dz = z 2 - 2az

rsample = (rsample - a)2

a

a (b - a)(c - a)

(b - a)(c - a)

a

(b - a)(c - a)

and for b rsample c, since

c

c

f(z)dz =

2(c - z) dz = 2cz - z 2 c

= (c - rsample) 2

rsample

rsample (c - b)(c - a)

(c - b)(c - a)

(c - b)(c - a)

rsample

we get

B

x = 1- (c - rsample) 2 (c - b)(c - a)

Since

b

f(z)dz

=

(b (c

- a) - a)

a

if the random probability x (b - a) then equation A is used to solve for (c - a)

rsample; otherwise equation B is used.

A rsample = a + (b - a)(c - a)x for x (b - a)/(c - a) B rsample = c - (c - b)(c - a)(1 - x) for x > (b - a)/(c - a)

Graphically, the sampling function has the appearance

rsample c

b

a

x

0

1

(b-a)/(c-a)

Example: (Note: the median corresponds to x= 0.5) For a=1, b = 2, c = 4 mean = (a+b+c)/3 = 2.333 mode = 2 median = c - (c - b)(c - a)(0.5) = 4 - 3 = 2.268

V. Gamma Distribution

A large number of useful functions are related to the exponential function. The gamma function is one of these. The gamma function generally traces from 18th century work by Euler in which he was using interpolation methods to define n! for non-integral values (it was later dubbed the gamma function by LeGendre in a series of books published between 1811 and 1826). The gamma function appears naturally in the study of anti-differentiation; i.e., it is also studied in the context of differential equations when calculating LaPlace transforms. The gamma function is given by

() = x -1e-xdx ( > 0)

0

Integrating by parts, we get

() = (-1)(-1) for > 1.

Since (1) = e-xdx =1 , then when is an integer, () = ( - 1)!

0

Hence, the gamma function is a generalization of the factorial, applying to all > 0, not just integers.

The gamma distribution is obtained from the gamma function by specifying

the pdf

f(x)

=

kx

-

1

-x

e ?

0

for x > 0 for fixed > 0 and > 0 otherwise

where the proportionality constant k is chosen so that f(x)dx = 1 . -

k is easy to figure:

x -

1= k x - 1e ? dx = k? t - 1e-t dt where x = t .

0

0

()

so

k

=

1 ?(

)

and f(x) is given by

( ) 1

?

x e -1 -x/?

is called shape (or order) parameter; us called the scale parameter.

Note that when = 1, f(x) =

1

- 1

e ?

x

which is the exponential distribution

?

with mean .

In general, E(X) = and 2 = 2 . Hence, if the mean and standard deviation can be estimated, then and can also be determined.

Algorithm for calculating the natural logarithm of the gamma function

Attributed to Lanczos, C., Journal S.I.A.M. Numerical Analysis, ser. B, vol. 1, p. 86 (1964)

and adapted from Numerical Recipes in C by Press, W.H., and B.P. Flannery, S.A. Teukolsky, W.T. Vetterling (Cambridge University Press, 1988).

FUNCTION lngamma(z) /* Use the reflection formula for z < 1 */ IF z < 1 z 1-z RETURN ln(z) - (lngamma(1 + z) + ln(sin(z)) ENDIF

coeff 76.18009173, -86.50532033, 24.01409822, -1.231739516, 0.00120858003, -0.00000536382 /* These values are the (approximate) coefficients for the first 6 terms of an infinite series involved in an exact formulation for the gamma function credited to Lanczos. They yield an approximation for the variable "a" (determined below) which is within || < 2 ? 10-10 of its true value */

a 1 FOR i 1 TO 6

a a + coeff(i)/(i + z - 1) ENDFOR

RETURN ln(a 2p ) - (z + 4.5) + (z - 0.5)ln(z + 4.5) END

Gamma pdf for fixed mean = 5 and varying values of and f(x)

0.6

0.5

=.5, =10

0.4

=1.5, =3.3333

=5, =1

0.3

=10, =.5

0.2

0.1

0

x

0

5

10

F(x) 1

.6

.2 0

0

Corresponding distribution functions and sampling functions

rsample

10

8

6

4

10

2

0

0 .2

.6

1

The gamma distribution is used to model waiting times or time to complete a

task. More specifically, it can be shown that if we have exponentially distributed interarrival times with mean 1/, the time needed to obtain k changes distributes according to a gamma distribution with = k and = 1/.

Gamma Function: ( ) = x - 1 e-x dx ( > 0) 0

The general relationship () = (-1)(-1) for > 1 holds. It can also be shown that ( ) (1 -) = for 0 < < 1.

sin( )

(Note that in particular, this means that (.5) = )

For 0 < < 1, 1 + > 1, so (1+) = ().

This in turn gives the reflection formula

(1 - )=

for 0 < < 1

(1 + )sin( )

Selected values computed according to the algorithm for ln(()).

(.25)

3.62560991

()

(.5) (.75)

=

1.77245385

1.22541670

10

(1) = 0!

=1

(1.25)

0.90640248

8

(1.5) = .5(.5) = / 2 0.88622693

(1.75) (2) = 1! (2.25)

0.91906253

=1

6

1.13300310

(2.5) = 1.5(1.5) = 3 / 4 1.32934039

4

(2.75)

1.60835942

(3) = 2!

=2

(3.25)

2.54925697

2

x 0! 1! 2! 3!

x

(3.5) = 2.5(2.5) = 15 / 8 3.32335097

x

x

(3.75) (4) = 3! (4.25)

4.42298841

0

=6

0

1

2

3

4

5

8.28508514

(4.5) = 3.5(3.5) = 105 p /16 11.63172840

(4.75) (5) = 4! (5.25)

16.58620654 = 24 35.21161185

(5.5) = 4.5(4.5) = 945 /32 52.34277778

(5.75)

78.78448105

(6) = 5!

= 120

For the pdf of the gamma distribution

f(x)

=

kx

-

1

-x

e ?

0

for x > 0 for fixed > 0 and > 0 otherwise

note that if: < 1 then x - 1 as x 0

= 1 then the distribution is the exponential distribution > 1 then x - 1 0 as x 0

The earlier example showed three basic shapes, each of which is described by

the behavior of the derivative f '(x) (slope function) of f(x). f '(x) = k[( - 1)x - 2 e-x/ + (-1/ )x - 1 e-x/]

There are actually 5 cases: < 1 the slope - as x 0

since each term is < 0 and each exponent of x is < 0 = 1 the slope -1/2 as x 0 in accord with the exponential distribution

since k = 1/, term 1 is 0 and term 2 is -1/

< 2 and > 1 the slope + as x 0

since the lead term + and term 2 is 0 = 2 the slope +1/2 as x 0

since k = 1/ = 1/2

> 2 the slope 0 as x 0

In each case the slope 0 as x +

The gamma distribution is one which is usually sampled by the accept-reject technique, which means to get k, the value of () must be computed.

VI. Erlang Distribution

Erlang was a Danish telephone engineer who did some of the early work in queuing theory. When is an integer i, then the gamma distribution is called an Erlang distribution of order i. The Erlang distribution is used to model phenomena having i stages, each with independent, exponentially distributed service times of mean ?. Rather than model these separately, an Erlang distribution of order i can be used to model the total service time; e.g., if an experiment has 3 successive stages each of which takes an average of 5 minutes (exponentially distributed), then the experiment time can be modeled by taking = 3 and = 5 (to get the overall mean of = 15 minutes).

VII. Weibull Distribution

Recall that for the gamma distribution the idea was to choose k so that

k x-1 e- x/? dx is equal to 1 and then choose f(x) = kx-1e-x/. 0

A major difficulty with this pdf is that it is not integrable in closed form; however, it is close to being so. The idea is to render the part under the integral to be in the form ezdz so that the function will be integrable; i.e., for

ke-(x/?)? x -1 dx we need to determine a ? value so that 0

for z = -(x/)?, dz = x-1dx

If z = -(x/) then dz = -(/)(x/) - 1dx and then

k

-

?

e-

0

(x/

? )

-?(x/

?)-1

dx

=

k

-

?

e

-(

x/?

)

0

=

k

?

= 1

when

k

=

?

This forms the basis for the Weibull distribution, which has the pdf

f(x)

=

?

x- ?

- 1e- 0

x ?

for x d otherwise

Remark: the effect of is to displace the distribution along the horizontal axis, so it is often taken to be 0.

With a little work, it can be shown that

E(X) = + (1 + 1/) and VAR(X) = 2((1 + 2/) - 2(1 + 1/))

Since

rsample

rsample

x =

f(z)dz

=

-

e

-

((

x

-

)/?

)

= 1- e-((rsample - )/?)

the sample function can be solve for rsample for given values of , , .

The Weibull distribution is often used to model time until failure (for example, light bulbs may have significant early failure and some have significant long term until failure) as per the following graph. When = 1, = 1/, = 0 then the Weibull distribution is the exponential distribution.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download