I often need to transform a uniform distribution into something different, e.g. to model behaviours.
Here are a few simple mathematical transformations transforming [0,1] to [0,1] resulting in different distributions.
x <- runif(10000)
df <- data.frame(n = 1:length(x),
x,
uniform = x,
squared = x^2,
sqrt = sqrt(x),
division = 2 - 2/(1+x),
gonio = 0.5 * (1 + sin((x*pi)-(pi/2))),
tanh = 0.5+tanh(2*(x-0.5)*pi)/2,
circular = 1-sqrt(1 - x^2)) %>% gather(transformation, value, -n, -x)
format(group_by(df, transformation) %>% summarise(avg = mean(value),
sd = sd(value),
Q1 = quantile(value, 0.25),
median = median(value),
Q3 = quantile(value, 0.75),
min = min(value),
max = max(value)), scientific=F, digits=5)
## transformation avg sd Q1 median Q3 min
## 1 circular 0.21204 0.22210 0.031000 0.13095 0.33701 0.000000060863
## 2 division 0.61003 0.28032 0.396231 0.66196 0.85625 0.000697539363
## 3 gonio 0.49536 0.35415 0.143198 0.49172 0.85202 0.000000300345
## 4 sqrt 0.66384 0.23572 0.497053 0.70337 0.86523 0.018678633901
## 5 squared 0.32979 0.29771 0.061040 0.24475 0.56044 0.000000121725
## 6 tanh 0.49433 0.41309 0.039982 0.48344 0.95789 0.001872136662
## 7 uniform 0.49625 0.28902 0.247062 0.49473 0.74863 0.000348891364
## max
## 1 0.98744
## 2 0.99996
## 3 1.00000
## 4 0.99996
## 5 0.99984
## 6 0.99813
## 7 0.99992
See eg https://www.r-statistics.com/2013/05/log-transformations-for-skewed-and-wide-distributions-from-practical-data-science-with-r/ monetary amounts are often lognormally distributed—that is, the log of the data is normally distributed
Behaviors are often zipf distributed
Natural phenomena are often normal distributed