0
$\begingroup$

Is there an easy algorithm for generating a random distribution within a range but skewed toward the ends?

I guess I am looking for some random distribution $x$ that is parameterized with some parameter $p \in [0,1]$ that might have the following properties, or at least something close to it:

  • $-1 \leq x \leq 1$ (I can always transform to some other range)
  • $E(x) = 0$
  • $E(x^2) = \frac{3-2p}{3}$

so that $p=0$ corresponds to a point distribution at the ends and $p=1$ corresponds to a uniform distribution.

$\endgroup$
2
  • 1
    $\begingroup$ There are myriad possibilities. For instance, you could start with any finite number of predefined distributions with these properties and take any mixture of them you wish. The issue, then, is not how to generate such variates, but why: what is it you are attempting to model, learn, or decide based on this process? What guidance can you give to help pin down an appropriate answer? $\endgroup$
    – whuber
    Commented Apr 27, 2017 at 23:04
  • $\begingroup$ While there's nothing in the problem statement that seems to require symmetry I suspect you may have it in mind - do you intend to have symmetric distributions or is that not a consideration? (I think whuber makes a good point -- it's easy enough to do, but what's this for?) $\endgroup$
    – Glen_b
    Commented Apr 28, 2017 at 0:15

1 Answer 1

0
$\begingroup$

Oh wait -- I just thought of something:

  • generate $u$ from a uniform distribution $\in [-1,1]$
  • calculate $x = |u|^p \operatorname{sgn} u$ for $0 < p \leq1$ (also include $p=0$ by defining $x=1$ if $u=0$), which yields a uniform distribution for $p=1$ and a point distribution for $p=0$.

Not sure of its variance, but the general behavior is what I'm looking for.

cdf here for p=0, 0.2, 0.4, 0.6, 0.8, 1.0

enter image description here

$\endgroup$
10
  • $\begingroup$ If you generate a random variable that way, it'll have zero "skewness" if that's what you're interested in. Or were you referring to something else when you wrote "skewed toward the ends"? $\endgroup$
    – jjet
    Commented Apr 27, 2017 at 22:51
  • $\begingroup$ Btw, if $X=|U|^p sgn(U)$ then the distribution of $\frac 1 2 (X+1)$ is given by a Beta(1/p, 1). Thus, $X$ is just a shifted and scaled version of Beta. $\endgroup$
    – jjet
    Commented Apr 27, 2017 at 22:55
  • $\begingroup$ sorry, I'm not sure what word I should use then, it has nothing to do with the third moment. $\endgroup$
    – Jason S
    Commented Apr 27, 2017 at 22:56
  • $\begingroup$ I guess you're referring to the tails of the distribution then. In that case, I think you had the right idea. A Beta(1/p,1/p) distribution moved to the interval [-1, 1] is probably your best bet. I believe your algorithm generates exactly that. $\endgroup$
    – jjet
    Commented Apr 27, 2017 at 23:02
  • 1
    $\begingroup$ I think you got what I was suggesting but in case I wasn't totally clear, it's this: Let $Z$ come from a $Beta(\frac 1 p, \frac 1 p)$ distribution. Then, set $X = 2Z - 1$. $X$ will have a distribution with mean, $E(X)=E(2Z-1)=2E(Z)-1=2 (1/p)/(1/p + 1/p) - 1=0$ and variance, $Var(X)=Var(2Z-1)=2^2 Var(Z)=4 (1/p)^2/((4/p^2)(2/p+1))=\frac p {2+p}$ $\endgroup$
    – jjet
    Commented Apr 28, 2017 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.