1

I am interested in simulated values that follow a certain distributional shape and map them on to values of a certain range.

Here is an example with the beta distribution.

rbeta(1000, 2, 1) |> 
  qunif(min = 10, max = 100) |> 
  hist()

Created on 2023-08-15 with reprex v2.0.2

I use the beta distribution to generate a distribution of probabilities of a certain shape then map those with the uniform quantile function into the value range I want in this case 10 to 100.

How would I do this with other distributions for example normal or weibull?

Vefeagins
  • 379

1 Answers1

5
  • First of all, using the "inverse uniform function" to transform the data is a strange way of saying that you are scaling it. Yes, it does the job, but you are not using it to do anything related to uniform distribution but to scale $x' \in [0, 1]$ to $x \in [a, b]$ by using a linear transformation $x = x' \times (b - a) + a$, which is the inverse of scaling to unit range $x' = (x - a) \big/ (b - a)$. You can use this transformation to transform any bounded random variable.
  • Normal distribution is unbounded, it ranges from $-\infty$ to $\infty$, and Weibull distribution from $0$ to $\infty$. You cannot "squeeze" an infinite range into the finite one like this. You would need truncated variants of those distributions to scale them. Alternatively, you could use something like logistic function to scale the variables into $[0, 1]$ and then use the scaling you described, but this would not preserve the initial shape of the distribution anymore.
  • But if you want to generate samples of distributions of arbitrary shape, you could instead just use kernel densities to approximate arbitrary distributions and sample from them.
Tim
  • 138,066