|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Normality.Dago
public static class Normality.Dago
Methods for computing the skewnewss, kurtosis, and D'Agostino-Peasrson K^2 "omnibus" test-statistics (that combine the former two), and accompanying significance (or p-values) for testing the underlying population normality.
Implementation:
Let mk
denote the k
th moment,
mk = ∑_(i=1 to n)(x_i - mean(x))/n.
Then, we can define the following:
Sample estimate of the third standardized moment: b1 = m3/(m2)^(3/2)
Sample estimate of the fourth standardized moment: b2 = m4/m2
The test statistics Z(b1), Z(b2) are approximately normally distributed under
the null hypothesis of population normality. Both Z(b1) and Z(b2) can be used to
test one-sided and two-sided alternative hypothesis.
D'Agostino and Pearson (1973) also introduced the following "omnibus" test statistic,
K^2 = (Z(b1))^2 + (Z(b2))^2
,
which is able to detect deviations from normality due to either skewness or kurtosis
This K^2 statistic has an approximately Chi-Squared distribution with 2 degrees of
freedom when the population is normally distributed.
Similar to Z(b1) and Z(b2), K^2 can be used to test one-sided and two-sided alternative hypothesis.
Requirements
data set has to have more than 20 elements. An error is thrown otherwise since the normal
approximation is no longer valid (technically, the it is valid for Zb1, as long as n > 8, but
since we're computing everything, the requirement has been set a little higher.
Remarks:
g1
and g2
used in SAS, and SPSS but they are related by a linear transformation (see
cited paper for details).
dagoTest
class in the fBasics library albeit with some implementation.
References:
D'Agostino, R., Albert Belanger, A., D'Agostino Jr, R., 1990
A Suggestion for Using Powerful and Informative Tests of Normality
D?Agostino, R., Pearson, E., 1973. Tests for departures from normality.
Empirical results for the distribution of b1 and b2.Biometrika 60, 613?622.
Method Summary | |
---|---|
static float[] |
chi2(float[] data)
Computes and returns an array containing the test statistic chi2 , or the
"omnibus" test statistic, and the significance, or "p-value" of this test statistic. |
static float[] |
kurtosis(float[] data)
Computes and returns an array containing the test statistic zb2 associated with
b2 and the significance, or "p-value" of the kurtosis test statistic zb2 , assuming a
two-tailed null hypothesis as well as . |
static float[] |
pValues(float[] data)
Returns an array containing the three significance, or p-values, for testing normality. |
static float[] |
skew(float[] data)
Computes and returns an array containing the test statistic zb1 associated with sqrt(b1) and
the significance, or "p-value" of the skew test statistic zb1 , assuming a
two-tailed null hypothesis as well as . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static float[] skew(float[] data)
zb1
associated with sqrt(b1) and
the significance, or "p-value" of the skew test statistic zb1
, assuming a
two-tailed null hypothesis as well as . The first element of the output array is the
test statistic zb1
associated with sqrt(b1) = m3/m2^(3/2) where mk is
the kth momement as specified in Descriptive.moment(float[], int, float)
and the second element is
the p-value for the two-tailed null hypothesis with
pValueSkew = 2* ( 1-Probability.normcdf( zb1 ) ).(D'Agostino et al. (1990)) .
public static float[] kurtosis(float[] data)
zb2
associated with
b2 and the significance, or "p-value" of the kurtosis test statistic zb2
, assuming a
two-tailed null hypothesis as well as . The first element of the output array is the
test statistic zb2
associated with b2 = m4/m2^2 where mk is
the kth momement as specified in Descriptive.moment(float[], int, float)
. and the second element is
the p-value for the two-tailed null hypothesis with
pValueKurtosis = 2* ( 1-Probability.normcdf( zb2 ) ).(D'Agostino et al. (1990)) .
public static float[] chi2(float[] data)
chi2
, or the
"omnibus" test statistic, and the significance, or "p-value" of this test statistic.
The first element of the output array is the test statistic the ombibus test
statistic chi2
and the second element is
the p-value:
pValueChiSquared = ( 1-Probability.chi2cdf( chi2 ) ).(D'Agostino et al. (1990)) .
public static float[] pValues(float[] data)
chi2(float[])
), the second corresponds to D'Agostino's
skew test (skew(float[])
), and the
third corresponds to D'Agostino's kurtosis test (kurtosis(float[])
).
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |