Date: Feb 22, 2013 5:16 PM
Author: Luis A. Afonso
Subject: Does data follows the Normal model?

Does data follows the Normal model?

This is the Jarque-Bera´s aim
en.wikipedia.org/wiki/Jarque?Bera_test
Exact Crtical values in:
http://mpra.ub.uni-muenchen.de/id/eprint/19155
(not used here because the p-values was obtained directly from Model Simulated data)

Data: 30 male spider´s length (my Sun, 28 Sep 2008 06:55)
From data I got the parameters mu= 5.917, sd= 0.663 and S= 1.0181, k= -1.9512, Skewness, Excess Kurtosis, respectively. Then the Test statistics JB= 9.942.

Test
Based on these parameters 40000 values X~N(mu, sd):30 were simulated (Box-Muller algorithm); for each sample S and k were calculated and compared with those obtained by real-world data counting how many of them is larger the above values (p-values). It was get 0.0461, 1.0000. I evaluated, as well, the JB test in order to find how many were larger than 9.952: the p-value (JB)= 0.0005.
Conclusion:
At 5% significance the Skewness is rejected by millimeters, on contrary k is fully not. Radically different for JB test, which lead us to reject Normality peremptorily, p-value = 0.05%.
By the artificial sum of Skewness and Excess Kurtosis the test does not reject a lot of data that, in fact, should be so, when each of the two parameters is viewed separately.

Luis A. Afonso

REM "ROLAND"
CLS
DEFDBL A-Z
PRINT : PRINT "______ROLAND______";
PRINT
PRINT " Does data follows the Normal Model ?"
pi = 4 * ATN(1): n = 30
DIM Y(n), Xs(n), V(n)
DIM W(n)
REM

INPUT " many= "; many
REM male
DATA 4.70,4.70,4.80,5.20,5.20,5.40,5.50,5.65,5.65,5.70
DATA 5.75,5.75,5.75,5.80,5.85,5.85,5.90,5.95,5.95,6.10
DATA 6.20,6.20,6.35,6.35,6.45,6.55,6.80,6.95,7.00,7.50
REM
REM
FOR i = 1 TO 30: READ Y(i)
mean = mean + Y(i) / n: ssY = ssY + Y(i) * Y(i): NEXT i
sdy = ssY - n * mean * mean
varY = sdy / (n - 1): sd = SQR(varY): COLOR 14
PRINT USING " mean= #.### "; mean;
PRINT USING " sd= #.### "; sd
m2 = 0: m3 = 0: m4 = 0
FOR ii = 1 TO n: dd = Y(ii) - m1
m2 = m2 + dd * dd / n
m3 = m3 + dd * dd * dd / n
m4 = m4 + dd * dd * dd * dd / n
NEXT ii
m2 = 0: m3 = 0: m4 = 0
FOR ii = 1 TO n: dd = Y(ii) - m1
m2 = m2 + dd * dd / n
m3 = m3 + dd * dd * dd / n
m4 = m4 + dd * dd * dd * dd / n
NEXT ii
S = m3 / (m2 ^ 1.5)
k = m4 / (m2 ^ 2) - 3
PRINT " Spiders male : ";
PRINT USING "S= ###.#### "; S;
PRINT USING "k= ###.#### "; k
JB = 30 * (S ^ 2 / 6 + k ^ 2 / 24)
PRINT USING " JB(obsv.) = ##.### "; JB
PRINT : PRINT
FOR j = 1 TO many
COLOR 14
RANDOMIZE TIMER
m1 = 0
FOR i = 1 TO n
1 a = RND
IF a < .0000001 THEN GOTO 1
aa = SQR(-2 * LOG(a))
Xs(i) = mean + aa * sd * COS(2 * pi * RND)
m1 = m1 + Xs(i) / n
NEXT i
m2 = 0: m3 = 0: m4 = 0
FOR ii = 1 TO n: dd = Y(ii) - m1
m2 = m2 + dd * dd / n
m3 = m3 + dd * dd * dd / n
m4 = m4 + dd * dd * dd * dd / n
NEXT ii
s1 = m3 / (m2 ^ 1.5)
k1 = m4 / (m2 ^ 2) - 3
IF s1 > S THEN sout = sout + 1
IF k1 > k THEN kout = kout + 1
jb1 = 30 * (s1 ^ 2 / 6 + k1 ^ 2 / 24)
IF jb1 > JB THEN exceed = exceed + 1 / many
NEXT j
PRINT " SIGNIFICANT S , k =";
PRINT USING "#.#### "; sout / many; kout / many
PRINT " JB(obsv.)<JB(model) =";
PRINT USING "#.#### "; exceed
END