clear set obs 100 forvalues i=1/5 { generate x`i' = rnormal() } alpha x1-x5, asis * (A missing value means the calculation * produced a negative number. This implies * that at least one item is reversed, or else * that the internal consistency is zero.) preserve * Calculating Alpha * calculate total score egen y = rowtotal(x1-x5) * calculate item variances collapse (sd) x1-x5 y forvalues i=1/5 { generate v`i' = (x`i')^2 } * sum of item variances egen sv = rowtotal(v1-v5) * and finally, alpha generate alpha = (5/4)*(1-(sv/(y^2))) list alpha restore clear set obs 100 matrix R = (1, 0.3, 0.3, 0.3, 0.3, /// 1, 0.3, 0.3, 0.3, /// 1, 0.3, 0.3, /// 1, 0.3, /// 1 ) drawnorm x1-x5, corr(R) cstorage(upper) alpha x1-x5 * Now, "asis" is redundant alpha x1-x5, asis clear set obs 100 matrix R = (1, 0.3, 0.3, 0.3, 0, /// 1, 0.3, 0.3, 0, /// 1, 0.3, 0, /// 1, 0, /// 1 ) drawnorm x1-x5, corr(R) cstorage(upper) alpha x1-x5 * Like the first example, sometimes different alpha x1-x5, asis clear set obs 100 matrix R = (1, 0.3, 0.3, 0.3, -0.3, /// 1, 0.3, 0.3, -0.3, /// 1, 0.3, -0.3, /// 1, -0.3, /// 1 ) drawnorm x1-x5, corr(R) cstorage(upper) alpha x1-x5 * In this example, always different alpha x1-x5, asis item