1099
Comment:

← Revision 25 as of 20130308 10:17:36 ⇥
981
converted to 1.6 markup

Deletions are marked like this.  Additions are marked like this. 
Line 5:  Line 5: 
The Gamma distribution [http://www.aiaccess.net/English/Glossaries/GlosMod/e_gm_gamma_distri.htm: may be produced by summing exponential distributions.] There are two parameters, n and $$\lambda$$. n is the number of summed exponentials and $$\lambda$$ is the exponential rate. When $$\lambda$$ is very small compared to n a negative skewed version of the gamma distribution results with no upper limit.  The Weibull distribution is negatively skewed and may be generated [[http://www.taygeta.com/random/weibull.xmlusing random variables which are uniform on the interval (0,1).]] 
Line 7:  Line 7: 
The below produces two exponential random variables (n=2) with a very small $$\lambda$$ (=1/10000) in SPSS and sums them. One resulting simulated data set produced using this macro had a skew of 1.03.  The below produces an open ended negatively skewed weibull distribution with parameters, 2 and 20. It has a median of $$2^text{0.05}ln(2)^text{0.05}$$ = 0.95. which is of form $$A^text{1/B}ln(2)^text{1/B}$$ where A and B are the two parameters of the Weibull distribution. (See [[http://www.weibull.com/AccelTestWeb/weibull_distribution.htmhere for formulae).]] 
Line 10:  Line 21: 
define !gamma ( !pos !tokens(1) /!pos !tokens(1)). !do !i=!1 !to !2 !by 1. compute !concat(a,!i)=(10000)*ln(rv.uniform(0,1)*10000). !doend. !enddefine. 
compute alpha=2. compute beta=20. 
Line 17:  Line 24: 
!gamma 1 2. exe. compute sum=(a1+a2). 
compute rvw=((1/alpha)*(ln(1rv.uniform(0,1))))**(1/beta). compute med=((alpha)**(1/beta))*(ln(2)**(1/beta)). 
How do I produce random variables which follow a negatively skewed distribution?
Most distributions such as the exponential and logNormal distributions are positively skewed with the mode of the distribution occurring for lower values.
The Weibull distribution is negatively skewed and may be generated using random variables which are uniform on the interval (0,1).
The below produces an open ended negatively skewed weibull distribution with parameters, 2 and 20. It has a median of
$$2^{text{0.05}ln(2)}text{0.05}$$ = 0.95.
which is of form
$$A^{text{1/B}ln(2)}text{1/B}$$
where A and B are the two parameters of the Weibull distribution. (See here for formulae).
compute alpha=2. compute beta=20. compute rvw=((1/alpha)*(ln(1rv.uniform(0,1))))**(1/beta). compute med=((alpha)**(1/beta))*(ln(2)**(1/beta)). exe.