I always always been interested in learning about how to make my own Probability Distribution Function.
For example, suppose I want to make a Probability Distribution Function that looks like a triangle and has a peak at 0.5. This would look something like this:
library(ggplot2)
df <- data.frame(x = c(0, 0.5, 1, 0), y = c(0, 0.5, 0, 0))
ggplot(df, aes(x, y)) +
geom_polygon(fill = "grey") +
xlab("X") +
ylab("P(X)") +
ggtitle("Trianglular Probability Distribution: X vs P(X)") +
theme_minimal()
I also know how to define this mathematically as a piece-wise function:
$$P(x) = \begin{cases} x & \text{if } 0 \leq x \leq 0.5, \\ -x + 1 & \text{if } 0.5 < x \leq 1. \end{cases}$$
However, there are some evident problems with this:
- There is no way of guaranteeing that this function integrates to 1
- This is a piecewise function and I do not think that a Probability Distributions can be defined in terms of piecewise functions
My Question: Is it possibly to take the work I have done and somehow modify it such that it becomes a valid probability distribution and integrates to 1?
Thanks!
Related Question:
