The D'Agostino Pearson k^2 test implemented in mathematica / variance of difference sign test

• To: mathgroup at smc.vnet.net
• Subject: [mg64990] The D'Agostino Pearson k^2 test implemented in mathematica / variance of difference sign test
• From: "john.hawkin at gmail.com" <john.hawkin at gmail.com>
• Date: Fri, 10 Mar 2006 05:15:23 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello,

I have two questions.

1.  Are there any resources of .nb files available on the internet
where I might find an implementation of the D'Agostino Pearson k^2 test
for normal variates?

2.  In the mathematica time series package (an add-on), the
"difference-sign" test of residuals is mentioned (url:
http://documents.wolfram.com/applications/timeseries/UsersGuidetoTimeSeries/1.6.2.html).
It says that the variance of this test is (n+1) / 2.  However, it
would seem to me that a simple calculation gives a variance of (n-1)/4.
It goes as follows:

If the series is differenced once, then the number of positive and
negative values in the difference should be approximately equal.  If Xi
denotes the sign of each value in the differenced series, then
Mean(Xi) = 0.5(1) + 0.5(0) = 0.5
Var(Xi) = Expectation( (Xi - Mean(Xi))^2 )
= Expectation( Xi^2 -Xi + 0.25 )
= 0.5 - 0.5 + 0.25
= 0.25

And assuming independence of each sign from the others, the total
variance should be the sum of the individual variances, up to n-1 for n
data points (since there are only n-1 changes in sign), thus

Variance = (n-1) / 4

There is an equivalent problem in Lemon's "Stochastic Physics" about
coin flips, for which the answer is listed, without proof, as (n-1)/8.
Because of these three conficting results I am wondering if I have made
an error in my calculation, and if anyone can find one please let me
know.

Thank you very much,

-John Hawkin

```

• Prev by Date: Re: Fastest method for comparing overlapping times in random time series
• Next by Date: Re: Automatic & linked axis scaling
• Previous by thread: Third Announcement of the International Mathematica Symposium 2006
• Next by thread: Re: The D'Agostino Pearson k^2 test implemented in mathematica / variance of difference sign test