回复: [chrony-users] question about the values in critical_runs array

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


> > >     where are the values in array critical_runs come from ?
> > >     for example, when there are total 50 sample points, if the total runs value is larger than 19, then the value of a and b is reliable.
> > >
> > >     the comment is "Critical value for number of runs of residuals with same sign. 5% critical region for now."
> > >     what is the formula or method to get the runs value of 19 for 50 samples?
> >
> > It's the Wald-Wolfowitz runs test with the assumption that n1==n2.
> >
> > The table is calculated like this:
> > - for i < 8 it's 0
> > - for i >= 8 it's mu - sqrt(var) * z where:
> >   mu = 2.0 * (i / 2.0) * (i / 2.0) / i + 1.0
> >   var = (mu - 1.0) * (mu - 2.0) / (i - 1)
> >   z = 1.65
> I examed this formula with i up to 129, and the result is same with critical_runs array !
> thanks very much!

I found a formula on the web:

      Z = [ r - E(r) ] / sigma

      E(r) = ( 2 * n1 * n2 ) / ( n1 + n2 ) + 1,

      sigma = sqrt{ [ 2 * n1 * n2 * (  2 * n1 * n2 - n1 - n2 ) ] / [ ( n1 + n2 ) *  ( n1 + n2 ) * ( n1 + n2 -1 ) ] }

if Z is z ,  r is runs , E(r) is mu ,  sigma is sqrt(var),   then r = Z * sigma + E(r). 

should  runs be   "mu + sqrt(var)"  or  "mu -sqrt(var)" ?


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/