Probability Density/Mass Functions (PDF/PMF)
When analyzing data, we often need to quantify the likelihood of different outcomes. For example, what is the chance a customer makes 3 purchases in a month, or that a sensor reading falls between 20 and 25 degrees Celsius? The tools for answering these questions depend on whether the variable is discrete (countable outcomes) or continuous (outcomes within a range). Probability Mass Functions (PMFs) and Probability Density Functions (PDFs) provide the mathematical framework for this quantification.
Probability Mass Function (PMF) for Discrete Variables
A Probability Mass Function (PMF) describes the probability that a discrete random variable takes on a specific value. For any given outcome , the PMF, denoted as or , directly gives the probability of observing that outcome. This means must be between 0 and 1, inclusive, for all possible values of . The sum of all probabilities for all possible outcomes must equal 1, representing the certainty that one of the possible outcomes will occur.
For a discrete random variable with possible values :
- for all
Probability Density Function (PDF) for Continuous Variables
For continuous random variables, we use a Probability Density Function (PDF), denoted as . Unlike PMFs, a PDF does not give the probability of a specific value . For any continuous variable, the probability of observing exactly one specific value is infinitesimally small, effectively zero. Instead, the PDF describes the relative likelihood for the variable to take on a given value within a continuous range. Higher values of indicate a greater density of probability around .
It is crucial to understand that itself is not a probability. A PDF value can even be greater than 1, which is impossible for a probability. Probabilities for continuous variables are found by calculating the area under the curve of the PDF over a specified interval. This requires integration.
For a continuous random variable :
- for all
- The probability that falls within an interval is given by:
Comparing PMF and PDF
While both PMF and PDF serve to describe the distribution of a random variable, their fundamental differences stem from the nature of the data they represent. Understanding these distinctions is critical for correctly interpreting probabilities and applying statistical methods. The key lies in how probability is assigned and aggregated across the variable's range.
| Feature | Probability Mass Function (PMF) | Probability Density Function (PDF) |
|---|---|---|
| Variable Type | Discrete (countable outcomes) | Continuous (uncountable outcomes within a range) |
| Output Value | Direct probability | Probability density (not a direct probability) |
| Value Range | (can be ) | |
| Total Probability | Sums to 1: | Integrates to 1: |
| Probability for Single Point | Non-zero probability | Zero probability |
| Graphical Representation | Bar chart (heights are probabilities) | Smooth curve (area under curve is probability) |
PMF for Discrete Variables: A Probability Mass Function assigns a direct probability to each specific, countable outcome of a discrete random variable. The sum of all PMF values must equal 1.
PDF for Continuous Variables: A Probability Density Function describes the relative likelihood of outcomes for a continuous random variable. Its value at a point is not a probability; it represents density.
Probability from PDF: For continuous variables, probability is found by calculating the area under the PDF curve over a given interval, typically using integration or a Cumulative Distribution Function (CDF).
Single Point Probability: For discrete variables, . For continuous variables, for any single point , because a point has no width.
Graphical Interpretation: PMFs are visualized with bar charts where bar heights are probabilities. PDFs are visualized with smooth curves, and probabilities are represented by areas under the curve.
Practical Use: Libraries like
scipy.statsprovide functions (.pmf()and.pdf()) to easily work with these distributions for both discrete and continuous data analysis.