Tag Archives: Gamma Distribution

Practice Problem Set 2 – Poisson and Gamma

This post presents exercises on gamma distribution and Poisson distribution, reinforcing the concepts discussed in this blog post in a companion blog and blog posts in another blog. Because the shape parameter of the gamma distribution in the following problems is a positive integer, the calculation of probabilities for the gamma distribution is based on Poisson distribution.

\text{ }

Practice Problem 2-A
Suppose that X is the useful working life (in years) of a brand new industrial machine. The following is the probability density function of X.

    \displaystyle f(t)=\frac{1}{24} \ \biggl(\frac{1}{5}\biggr)^5 \ t^4 \ e^{-\frac{1}{5} \ t} \ \ \ \ \ \ t>0

A manufacturing plant has just purchased such a new machine. Determine the probability that the machine will be in operation for the next 20 years.

\text{ }

Practice Problem 2-B

The annual rainfall (in inches) in Western Colorado is modeled by a distribution with the following cumulative distribution function.

    \displaystyle F(x)=1-e^{-0.2 x}-0.2 \ x \ e^{-0.2 x}-0.02 \ x^2 \ e^{-0.2 x} \ \ \ \ \ \ \ 0<x<\infty

In a year in which the annual rainfall is above 20 inches, determine the probability that the annual rainfall is above 30 inches.

\text{ }

Practice Problem 2-C

The annual rainfall (in inches) in Western Colorado is modeled by a distribution with the following cumulative distribution function.

    \displaystyle F(x)=1-e^{-0.2 x}-0.2 \ x \ e^{-0.2 x}-0.02 \ x^2 \ e^{-0.2 x} \ \ \ \ \ \ \ 0<x<\infty

Determine the mean and the variance of the annual rainfall in this region.

\text{ }

Practice Problem 2-D

The repair time (in hours) for an industrial machine has a gamma distribution with mean 1.5 and variance 0.75.

  • Determine the probability that a repair time exceeds 2 hours.
  • Determine the probability that a repair time is at least 5 hours given that it already exceeds 2 hours.

\text{ }

Practice Problem 2-E

Customers arriving at a jewelry store according to a Poisson process with an average rate of 2.5 per hours. The store opens its door at 9 AM.

  • What is the probability that the first customer arrives at the store before 11 AM?
  • What is the probability that the first two customers arrive at the store before 11 AM?
  • What is the probability that the first three customers arrive at the store before 11 AM?
  • What is the probability that the first five customers arrive at the store before 11 AM?

\text{ }

Practice Problem 2-F
In a certain city, telephone calls to 911 emergency response system arrive on the average of two every 3 minutes. Suppose that the arrivals of 911 calls are modeled by a Poisson process.

  • What is the probability of four or more calls arriving in a 5-minute period?
  • A call to the 911 system just ended. What is the probability that the wait time for the next 6 calls is more than 10 minutes?

\text{ }

Practice Problem 2-G

Customers arrive at a store at an average rate of 30 per hour according to a Poisson process.

  • Determine the probability that at least 5 customers arrive at the store in the first 10 minutes after opening on a given day.
  • Determine the probability that, after opening, it will take more than 15 minutes for the 6th customer to arrive at the store.

\text{ }

Practice Problem 2-H
Cars arrive at a highway tollbooth at an average rate of 6 cars every 10 minutes according to a Poisson process.

  • Determine the probability that the toll collector will have to wait longer than 20 minutes before collecting the seventh toll.
  • A toll collector just starts his shift. Determine the median time (in minutes) until he collects the first toll.

\text{ }

Practice Problem 2-I
The number of claims in a year for an insured from a large group of insureds is modeled by the following model.

    \displaystyle P(X=x \lvert \lambda)=\frac{e^{-\lambda} \lambda^x}{x!} \ \ \ \ \ x=0,1,2,3,\cdots

The parameter \lambda varies from insured to insured. However, it is known that \lambda is modeled by the following density function.

    \displaystyle g(\lambda)=32 \ \lambda^2 \ e^{-4 \lambda} \ \ \ \ \ \ \lambda>0

An insured is randomly selected from the large group of insureds. Determine the mean and the variance of the number of claims for this insured in the next year.

\text{ }

Practice Problem 2-J
Suppose that the number of accidents per year per driver in a large group of insured drivers follows a Poisson distribution with mean \lambda. The parameter \lambda follows a gamma distribution with mean 0.9 and variance 0.27.

Given that a randomly selected insured has at least one claim, determine the probability that the insured has more than one claim.

\text{ }

Practice Problem 2-K

Customers arrive at a shop according to a Poisson process. The waiting time (in minutes) until the 5th customer is modeled by the following density function.

    \displaystyle f(t)=324 \ t^4 \ e^{-6 \ t} \ \ \ \ \ \ t>0

  • Determine mean and variance of the time until the 6th customer after the opening of the shop on a given day.
  • Determine the probability that the wait for the 7th customer is longer than 2 minutes.

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

Problem ………..Answer
2-A
  • \displaystyle \frac{103}{3} e^{-4}=0.6288
2-B
  • \displaystyle \frac{25}{13} e^{-2}=0.2603
2-C
  • mean = 15
  • variance = 75
2-D
  • \displaystyle P(X>2)=13 e^{-4}
  • \displaystyle P(X>5 \lvert X>2)=\frac{61}{13} \ e^{-6}=0.01163
2-E
  • \displaystyle 1-e^{-5}=0.99326
  • \displaystyle 1-6 e^{-5}=0.95957
  • \displaystyle 1-18.5 e^{-5}=0.87535
  • \displaystyle 1-\frac{1569}{24} e^{-5}=0.55951
2-F
  • \displaystyle 1-\frac{1301}{81} e^{-10/3}=0.4270
  • \displaystyle 1-\frac{197789}{729} e^{-20/3}=0.6547
2-G
  • \displaystyle 1-\frac{1569}{24} e^{-5}=0.5595
  • \displaystyle \frac{52383.28125}{120} e^{-7.5}=0.241436
2-H
  • \displaystyle 7457.8 e^{-12}=0.04582
  • \displaystyle \frac{\text{ln}(0.5)}{-0.6}=1.15525 min
2-I
  • mean = 0.75
  • variance = 0.9375
2-J
  • \displaystyle \frac{0.6561}{1.3^4}=0.22972
2-K
  • mean = 1, variance = 1/6
  • \displaystyle 7457.8 e^{-12}=0.04582

Daniel Ma mathematics

Dan Ma math

Daniel Ma probability

Dan Ma probability

Daniel Ma statistics

Dan Ma statistics

\copyright 2018 – Dan Ma

Advertisements

Calculating the skewness of a probability distribution

This post presents exercises on calculating the moment coefficient of skewness. These exercises are to reinforce the calculation demonstrated in this companion blog post.

For a given random variable X, the Pearson’s moment coefficient of skewness (or the coefficient of skewness) is denoted by \gamma_1 and is defined as follows:

    \displaystyle \begin{aligned} \gamma_1&=\frac{E[ (X-\mu)^3 ]}{\sigma^3} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (1) \\&=\frac{E(X^3)-3 \mu E(X^2)+3 \mu^2 E(X)-\mu^3}{\sigma^3} \\&=\frac{E(X^3)-3 \mu [E(X^2)+\mu E(X)]-\mu^3}{\sigma^3} \\&=\frac{E(X^3)-3 \mu \sigma^2-\mu^3}{\sigma^3} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (2) \\&=\frac{E(X^3)-3 \mu \sigma^2-\mu^3}{(\sigma^2)^{\frac{3}{2}}} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (3) \end{aligned}

(1) is the definition which is the ratio of the third central moment to the cube of the standard deviation. (2) and (3) are forms that may be easier to calculate. Essentially, if the first three raw moments E(X), E(X^2) and E(X^3) are calculated, then the skewness coefficient can be derived via (3). For a more detailed discussion, see the companion blog post.

_____________________________________________________________________________________

Practice Problems

Practice Problems 1
Let X be a random variable with density function f(x)=10 x^9 where 0<x<1. This is a beta distribution. Calculate the moment coefficient of skewness in two ways. One is to use formula (3) above. The other is to use the following formula for the skewness coefficient for beta distribution.

    \displaystyle \gamma_1=\frac{2(\beta-\alpha) \ \sqrt{\alpha+\beta+1}}{(\alpha+\beta+2) \ \sqrt{\alpha \ \beta}} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (4)

\text{ }

Practice Problems 2
Calculate the moment coefficient of skewness for Y=X^2 where X is as in Practice Problem 1. It will be helpful to first calculate a formula for the raw moments E(X^k) of X.

\text{ }

Practice Problems 3
Let X be a random variable with density function f(x)=8 (1-x)^7 where 0<x<1. This is a beta distribution. Calculate the moment coefficient of skewness using (4).

\text{ }

Practice Problems 4
Suppose that X follows a gamma distribution with PDF f(x)=4 x e^{-2x} where x>0.

  • Show that E(X)=1, E(X^2)=\frac{3}{2} and E(X^3)=3.
  • Use the first three raw moments to calculate the moment coefficient of skewness.

\text{ }

Practice Problems 5
Calculate the moment coefficient of skewness for Y=X^2 where X is as in Practice Problem 4. It will be helpful to first calculate a formula for the raw moments E(X^k) of X.

\text{ }

Practice Problems 6
Verify the calculation of \gamma_1 and the associated calculation of Example 6 in this companion blog post.

\text{ }

Practice Problems 7
Verify the calculation of \gamma_1 and the associated calculation of Example 7 in this companion blog post.

\text{ }

Practice Problems 8
Verify the calculation of \gamma_1 and the associated calculation of Example 8 in this companion blog post.

\text{ }
_____________________________________________________________________________________

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }

\text{ }
_____________________________________________________________________________________

Answers

Practice Problems 1

  • \displaystyle \gamma_1=\frac{-36 \sqrt{3}}{13 \sqrt{10}}=-1.516770159

\text{ }

Practice Problems 2

  • \displaystyle \gamma_1=\frac{- \sqrt{7}}{\sqrt{5}}=-1.183215957

\text{ }

Practice Problems 3

  • \displaystyle \gamma_1=\frac{7 \sqrt{10}}{11 \sqrt{2}}=1.422952349

\text{ }

Practice Problems 4

  • \displaystyle \gamma_1=\sqrt{2}

\text{ }

Practice Problems 5

  • \displaystyle \gamma_1=\frac{138}{7 \sqrt{21}}=4.302009836

\text{ }

_____________________________________________________________________________________

\copyright \ 2015 \text{ by Dan Ma}

Another Example of a Joint Distribution

In an earlier post called An Example of a Joint Distribution, we worked a problem involving a joint distribution that is constructed from taking product of a conditional distribution and a marginial distribution (both discrete distributions). In this post, we work on similar problems for the continuous case. We work problem A. Problem B is left as exercises.

_________________________________________________________________

Problem A
Let X be a random variable with the density function f_X(x)=\alpha^2 \ x \ e^{-\alpha x} where x>0. For each realized value X=x, the conditional variable Y \lvert X=x is uniformly distributed over the interval (0,x), denoted symbolically by Y \lvert X=x \sim U(0,x). Obtain solutions for the following:

  1. Discuss the joint density function for X and Y.
  2. Calculate the marginal distribution of X, in particular the mean and variance.
  3. Calculate the marginal distribution of Y, in particular, the density function, mean and variance.
  4. Use the joint density in part A-1 to calculate the covariance Cov(X,Y) and the correlation coefficient \rho.

_________________________________________________________________

Problem B
Let X be a random variable with the density function f_X(x)=4 \ x^3 where 0<x<1. For each realized value X=x, the conditional variable Y \lvert X=x is uniformly distributed over the interval (0,x), denoted symbolically by Y \lvert X=x \sim U(0,x). Obtain solutions for the following:

  1. Discuss the joint density function for X and Y.
  2. Calculate the marginal distribution of X, in particular the mean and variance.
  3. Calculate the marginal distribution of Y, in particular, the density function, mean and variance.
  4. Use the joint density in part B-1 to calculate the covariance Cov(X,Y) and the correlation coefficient \rho.

_________________________________________________________________

Discussion of Problem A

Problem A-1

The support of the joint density function f_{X,Y}(x,y) is the unbounded lower triangle in the xy-plane (see the shaded region in green in the figure below).

Figure 1

The unbounded green region consists of vertical lines: for each x>0, y ranges from 0 to x (the red vertical line in the figure below is one such line).

Figure 2

For each point (x,y) in each vertical line, we assign a density value f_{X,Y}(x,y) which is a positive number. Taken together these density values sum to 1.0 and describe the behavior of the variables X and Y across the green region. If a realized value of X is x, then the conditional density function of Y \lvert X=x is:

    \displaystyle f_{Y \lvert X=x}(y \lvert x)=\frac{f_{X,Y}(x,y)}{f_X(x)}

Thus we have f_{X,Y}(x,y) = f_{Y \lvert X=x}(y \lvert x) \times f_X(x). In our problem at hand, the joint density function is:

    \displaystyle \begin{aligned} f_{X,Y}(x,y)&=f_{Y \lvert X=x}(y \lvert x) \times f_X(x) \\&=\frac{1}{x} \times \alpha^2 \ x \ e^{-\alpha x} \\&=\alpha^2 \ e^{-\alpha x}  \end{aligned}

As indicated above, the support of f_{X,Y}(x,y) is the region x>0 and 0<y<x (the region shaded green in the above figures).

Problem A-2

The unconditional density function of X is f_X(x)=\alpha^2 \ x \ e^{-\alpha x} (given above in the problem) is the density function of the sum of two independent exponential variables with the common density f(x)=\alpha e^{-\alpha x} (see this blog post for the derivation using convolution method). Since X is the independent sum of two identical exponential distributions, the mean and variance of X is twice that of the same item of the exponential distribution. We have:

    \displaystyle E(X)=\frac{2}{\alpha}

    \displaystyle Var(X)=\frac{2}{\alpha^2}

Problem A-3

To find the marginal density of Y, for each applicable y, we need to sum out the x. According to the following figure, for each y, we sum out all x values in a horizontal line such that y<x<\infty (see the blue horizontal line).

Figure 3

Thus we have:

    \displaystyle \begin{aligned} f_Y(y)&=\int_y^\infty f_{X,Y}(x,y) \ dy \ dx \\&=\int_y^\infty \alpha^2 \ e^{-\alpha x} \ dy \ dx \\&=\alpha \int_y^\infty \alpha \ e^{-\alpha x} \ dy \ dx \\&= \alpha e^{-\alpha y}  \end{aligned}

Thus the marginal distribution of Y is an exponential distribution. The mean and variance of Y are:

    \displaystyle E(Y)=\frac{1}{\alpha}

    \displaystyle Var(Y)=\frac{1}{\alpha^2}

Problem A-4

The covariance of X and Y is defined as Cov(X,Y)=E[(X-\mu_X) (Y-\mu_Y)], which is equivalent to:

    \displaystyle Cov(X,Y)=E(X Y)-\mu_X \mu_Y

where \mu_X=E(X) and \mu_Y=E(Y). Knowing the joint density f_{X,Y}(x,y), we can calculate Cov(X,Y) directly. We have:

    \displaystyle \begin{aligned} E(X Y)&=\int_0^\infty \int_0^x  xy \ f_{X,Y}(x,y) \ dy \ dx \\&=\int_0^\infty \int_0^x xy \ \alpha^2 \ e^{-\alpha x} \ dy \ dx \\&=\int_0^\infty \frac{\alpha^2}{2} \ x^3 \ e^{-\alpha x} \ dy \ dx \\&= \frac{3}{\alpha^2} \int_0^\infty \frac{\alpha^4}{3!} \ x^{4-1} \ e^{-\alpha x} \ dy \ dx \\&= \frac{3}{\alpha^2} \end{aligned}

Note that the last integrand in the last integral in the above derivation is that of a Gamma distribution (hence the integral is 1.0). Now the covariance of X and Y is:

    \displaystyle Cov(X,Y)=\frac{3}{\alpha^2}-\frac{2}{\alpha} \frac{1}{\alpha}=\frac{1}{\alpha^2}

The following is the calculation of the correlation coefficient:

    \displaystyle \begin{aligned} \rho&=\frac{Cov(X,Y)}{\sigma_X \ \sigma_Y} = \frac{\displaystyle \frac{1}{\alpha^2}}{\displaystyle \frac{\sqrt{2}}{\alpha} \ \frac{1}{\alpha}} \\&=\frac{1}{\sqrt{2}} = 0.7071 \end{aligned}

Even without the calculation of \rho, we know that X and Y are positively and quite strongly correlated. The conditional distribution of Y \lvert X=x is U(0,x) which increases with x. The calculation of Cov(X,Y) and \rho confirms our observation.

_________________________________________________________________

Answers for Problem B

Problem B-1

    \displaystyle f_{X,Y}(x,y)=4 \ x^2 where x>0, and 0<y<x.

Problem B-2

    \displaystyle E(X)=\frac{4}{5}
    \displaystyle Var(X)=\frac{2}{75}

Problem B-3

    \displaystyle f_Y(y)=\frac{4}{3} \ (1- y^3)

    \displaystyle E(Y)=\frac{2}{5}

    \displaystyle Var(Y)=\frac{14}{225}

Problem B-4

    \displaystyle Cov(X,Y)=\frac{1}{75}

    \displaystyle \rho = \frac{\sqrt{3}}{2 \sqrt{7}}=0.327327

_________________________________________________________________