The Gamma Probability Density Function (Gamma PDF) is a statistical model to predict the waiting time of a random continuous event. The event of concern assumed to follow a Poisson random process (for the time being forget about Poisson random process)
Probability Density Function (PDF), in statistics, a function whose integral (a numerical value equal to the area under the graph of a function for some interval) is calculated to find probabilities associated with a continuous random variable. Its graph is a curve above the horizontal axis that defines a total area, between itself and the axis, of 1. (https://www.britannica.com/science/density-function)
The gamma PDF uses two parameters (parameters are descriptive measures of an entire population that may be used as the inputs for a probability density function (PDF) to generate distribution curves. If the population data are not available, we estimate these parameters using a sample data) to describe the model,
A familiar example to understand the model parameters would be the intercept (a) and beta coefficient (b) in a simple linear regression model, y = a + bx. For a given scenario/dataset, intercept, and the beta coefficient are constant.
Once you have estimates for shape and scale parameters using available data, a gamma probability density graph can be produced. The resulting graph can be used to estimate the waiting time probabilities.
I will use the following example to describe the application of gamma PDF.
Example: The breathing rate of a trained athlete was monitored. After one hour period of monitoring, the average breathing rate was found to be 12 breaths per minute (or 60 seconds). If his breathing rate is considered as a Poisson process, what will be the probability density distribution of waiting time for,
Using the breathing rate (12 breaths per minute), we can find the breathing rate per second. I used seconds instead of minutes for easy (unit) comprehension. Use of unit time interval is your choice.
Breathing rate = 12 breaths per minute (or per 60 seconds) = 12/60 breath per second = 0.2 breath per second
This is the scale/rate/lambda parameter for the gamma PDF.
Now I want to find the probability density distribution of waiting time for the first breath from a staring time, i.e. t = 0 (in my understanding it can be anywhere of the timeline).
I will use dgamma() function (density gamma function) in the R statistical package to derive the results and plot() function to display the results graphically.
dgamma() takes three argument/variable values to estimate the probability density value (i.e. y-axis value for given x-axis value)
I use gammaProbDen variable to store the dgamma() function output.
gammaProbDen <- dgamma(x = 0:30, shape = 1, rate = 0.2)
I have drawn a few other waiting time probability density curves, i.e., for the second breath and third breadth.
Now it is time to interpret the estimates. As mentioned at the beginning, results are in probability density terms. Referring to Figure 01, what is the probability of first event to occur less than 5 seconds of waiting time? To find the probability for this question, area under the curve from t=0s to t=5s need to be estimated. The pgamma() function of the R statistical package can be used for this purpose. Similar to dgamma(), pgamma() takes three arguments/variable for the estimation.
pgamma(q = 2, shape = 1, rate = 0.2)
## [1] 0.32968
Therefore, the probability of seeing the first event (i.e. the breath) within first 3 second is 33%.
If we need to estimate the waiting time for 2nd breath within 3 seconds from t0 is,
pgamma(q = 3, shape = 2, rate = 0.2)
## [1] 0.1219014
If you want to see how the probability cumulate within the first 5 seconds for the second event, use the pgamma() as follows
pgamma(q = 0:5, shape = 2, rate = 0.2)
## [1] 0.00000000 0.01752310 0.06155194 0.12190138 0.19120786 0.26424112
If you find any conceptual errors in this writing, please feel free to comment.
Some additional references: