# Finding parameters that set the variance and skew of a distribution.

Aim

I aim to run some numerical simulations where a random variable of interest (Let's call it $X$) can take different distribution. Past studies, always assumed that $X$ is normally distributed while it is not uncommon that $X$ is actually skewed in reality.

I'd like to be able to vary (from one simulation to another) the variance $V$ and the skew $S$ (keeping the mean constant at zero) and get a distribution of always the same kind with this variance and this skew. Because past work were based on a normal distribution, I'd like my distribution to "kinda look like a normal distribution".

Can you help with that?

What I tried

I thought about using the skewed normal distribution. I tried to find out what parameter set I should use to get a given skew and variance. I tried to solve the following system of equation for $\alpha$, $\omega$ and $\xi$.

$$Variance = \left(1-\frac{2 \alpha ^2}{\pi \left(\alpha ^2+1\right)}\right) \omega ^2$$

$$Skew = \frac{\sqrt{2} (4-\pi ) \alpha ^3}{\pi ^{3/2} \left(\alpha ^2+1\right)^{3/2} \left(1-\frac{2 \alpha }{\pi \sqrt{\alpha ^2+1}}\right)^{3/2}}$$

$$Mean = \frac{\sqrt{\frac{2}{\pi }} \alpha \omega }{\sqrt{\alpha ^2+1}}+\xi = 0$$

... but I failed! It would be perfect to me if only one parameter set would yield to a given mean, variance and skew but I am not sure this is going to be true.

A skewed normal distribution might arguably not be the best choice of distribution. I thought about using a Beta distribution as well but I ran into the same kind of issue. I fail to solve these hairy equations.

In one parameterization, the parameters are shape $\alpha$ and rate $\lambda.$ The skewness is $1/\sqrt{\alpha}.$ The variance is $\alpha/\lambda^2.$ The mean is $\alpha/\lambda$, but you could subtract that if you need mean 0. The R code for generating $n$ independent observations, before any centering, is 'rgamma(n, alpha, lambda)'.
• Over the landscape the optimum phenotype is changing linearly. Fish can migrate and the probability of migrating to a patch at distance $x$ will be given by a gamma function thanks to your answer. The simulations is coded in C++ and it will probably run for 2 days. The main goal is to study the evolution of the geographic range limit in fishes when facing asymmetric dispersal. Mar 31, 2015 at 18:03