đ Introduction
A probability distribution describes how the probabilities of possible values of a random variable are distributed. It provides a mathematical model that explains the likelihood of different outcomes occurring. Probability distributions are fundamental in statistics, data science, machine learning, finance, engineering, and scientific research.
Information
đ¯ Why Learn Probability Distributions?
- Model random events mathematically.
- Analyze uncertainty in data.
- Perform statistical inference.
- Simulate real-world processes.
- Support predictive modeling and machine learning.
đ Types of Probability Distributions
đ Discrete vs Continuous Distributions
| Feature | Discrete Distribution | Continuous Distribution |
|---|---|---|
| Values | Countable values. | Infinite possible values. |
| Examples | Binomial, Poisson. | Normal, Uniform, Exponential. |
| Probability | Probability of exact values. | Probability over intervals. |
đĻ Distribution Function Prefixes in R
R uses a consistent naming convention for distribution-related functions.
| Prefix | Purpose | Example |
|---|---|---|
| d | Density or probability mass function. | dnorm() |
| p | Cumulative distribution function. | pnorm() |
| q | Quantile function. | qnorm() |
| r | Random number generation. | rnorm() |
đ Normal Distribution
The normal distribution is a continuous distribution that is symmetric around its mean. It is widely used because many natural phenomena approximately follow a normal distribution.
Normal Distribution
dnorm(
x = 0,
mean = 0,
sd = 1
)
pnorm(
q = 1.96,
mean = 0,
sd = 1
)
qnorm(
p = 0.975
)
rnorm(
n = 5,
mean = 50,
sd = 10
)đ˛ Binomial Distribution
The binomial distribution models the number of successes in a fixed number of independent trials.
Binomial Distribution
dbinom(
x = 4,
size = 10,
prob = 0.5
)
pbinom(
q = 4,
size = 10,
prob = 0.5
)
rbinom(
n = 5,
size = 10,
prob = 0.5
)đ¯ Poisson Distribution
The Poisson distribution models the number of events occurring within a fixed interval of time or space.
Poisson Distribution
dpois(
x = 3,
lambda = 2
)
ppois(
q = 3,
lambda = 2
)
rpois(
n = 5,
lambda = 2
)đ Uniform Distribution
In a uniform distribution, every value within a specified interval has an equal probability.
Uniform Distribution
dunif(
x = 5,
min = 0,
max = 10
)
punif(
q = 5,
min = 0,
max = 10
)
runif(
n = 5,
min = 0,
max = 10
)âŗ Exponential Distribution
The exponential distribution models the waiting time between independent events occurring at a constant average rate.
Exponential Distribution
dexp(
x = 2,
rate = 0.5
)
pexp(
q = 2,
rate = 0.5
)
rexp(
n = 5,
rate = 0.5
)đ Visualizing a Normal Distribution
Normal Distribution Curve
x <- seq(
-4,
4,
length = 100
)
y <- dnorm(x)
plot(
x,
y,
type = "l",
col = "blue",
lwd = 2,
main = "Normal Distribution",
xlab = "X",
ylab = "Density"
)đ Generating Random Samples
Random values can be generated from probability distributions for simulations and testing.
Random Samples
normalSample <- rnorm(
10,
mean = 100,
sd = 15
)
binomialSample <- rbinom(
10,
size = 20,
prob = 0.6
)
poissonSample <- rpois(
10,
lambda = 5
)
print(normalSample)
print(binomialSample)
print(poissonSample)đ Comparing Common Distributions
| Distribution | Type | Typical Applications |
|---|---|---|
| Normal | Continuous | Heights, exam scores, measurement errors. |
| Binomial | Discrete | Coin tosses, quality control. |
| Poisson | Discrete | Customer arrivals, network traffic. |
| Uniform | Continuous | Random number generation. |
| Exponential | Continuous | Waiting times and reliability analysis. |
đ Simulating Coin Tosses
The binomial distribution can simulate repeated coin toss experiments.
Coin Toss Simulation
coinTosses <- rbinom(
n = 20,
size = 10,
prob = 0.5
)
table(coinTosses)
hist(
coinTosses,
col = "lightblue",
main = "Coin Toss Simulation"
)đ Real-World Example
A call center receives an average of five calls every hour. The Poisson distribution can estimate the probability of receiving different numbers of calls.
Call Center Analysis
probability <- dpois(
x = 7,
lambda = 5
)
print(probability)
calls <- rpois(
20,
lambda = 5
)
hist(
calls,
col = "orange",
main = "Hourly Calls"
)đ Probability Distribution Workflow
đ Common Distribution Functions
| Function | Description |
|---|---|
| dnorm() | Normal density. |
| pnorm() | Normal cumulative probability. |
| rnorm() | Random normal values. |
| dbinom() | Binomial probability. |
| dpois() | Poisson probability. |
| dunif() | Uniform density. |
| dexp() | Exponential density. |
â ī¸ Common Mistakes
| Mistake | Explanation | Solution |
|---|---|---|
| Using the wrong distribution | Results may not accurately represent the data. | Select a distribution that matches the characteristics of the problem. |
| Confusing density with probability | For continuous distributions, density is not the same as probability at a single point. | Use cumulative probabilities for interval-based questions. |
| Incorrect parameter values | May produce misleading results. | Verify arguments such as mean, sd, size, and lambda. |
| Ignoring distribution assumptions | Statistical conclusions may become invalid. | Check whether the chosen distribution fits the data. |
đĄ Best Practices
- Understand the assumptions behind each distribution.
- Use visualizations to inspect generated data.
- Choose the appropriate distribution for the problem.
- Verify parameter values before calculations.
- Use simulations to validate statistical models.
Best Practice
đ Summary
Probability distributions describe how the values of a random variable are distributed. In R, built-in functions support common distributions such as the normal, binomial, Poisson, uniform, and exponential distributions through a consistent naming convention using the prefixes d, p, q, and r. You also learned how to calculate probabilities, generate random samples, visualize distributions, and apply these concepts to real-world scenarios. Mastering probability distributions is essential for statistical analysis, simulation, hypothesis testing, and predictive modeling.