If you want to write a program yourself,
there are various algorithms; the following solution is based
on one of these alternatives.
Consider first the scalar SN case.
- Sample
having marginal distribution N(0,1) and correlation
. A simple way to achieve
this is to generate
as independent N(0,1) variates and define
.
- Then
is a random number sampled from the SN distribution with
shape parameter
.
- To change the location and scale from (0,1) to (a,b)
with b>0, say, set y=a+b z.
Consider now the bivariate SN case;
the general multivariate case is similar.
- Sample
all having marginal N(0,1) distribution and correlation matrix
.
- Then
is a random vector sampled from the bivariate SN distribution with
(vector) shape parameter
, where
For mathematical details and the general multivariate case, see
Proposition 1 of
Azzalini & Capitanio (1999).
- If required, change the location and scale of
z, similarly to the scalar case; this must be done
component by component.
To obtain a ST variate, generate
and put
;
then w has ST distribution with
degrees of freedom and shape parameter equal to the one of z.
This works both for z scalar or multivariate. Again, this can be
followed by scale and location change of w.
For mathematical details, see Section 4 of
Azzalini & Capitanio (2003).