c14-5 (779580), страница 2
Текст из файла (страница 2)
. ., N , then the resulting list of numbers will be drawn from a perfectlyknown distribution function, namely uniformly from the integers between 1 and N ,inclusive. Better than uniformly, in fact, since if the xi ’s are all distinct, then eachinteger will occur precisely once. If some of the xi ’s have identical values, it isconventional to assign to all these “ties” the mean of the ranks that they would havehad if their values had been slightly different. This midrank will sometimes be aninteger, sometimes a half-integer.
In all cases the sum of all assigned ranks will bethe same as the sum of the integers from 1 to N , namely 12 N (N + 1).Of course we do exactly the same procedure for the yi ’s, replacing each valueby its rank among the other yi ’s in the sample.Now we are free to invent statistics for detecting correlation between uniformsets of integers between 1 and N , keeping in mind the possibility of ties in the ranks.There is, of course, some loss of information in replacing the original numbers byranks.
We could construct some rather artificial examples where a correlation couldbe detected parametrically (e.g., in the linear correlation coefficient r), but could notSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.
Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).sxy += xt*yt;}*r=sxy/(sqrt(sxx*syy)+TINY);*z=0.5*log((1.0+(*r)+TINY)/(1.0-(*r)+TINY));Fisher’s z transformation.df=n-2;t=(*r)*sqrt(df/((1.0-(*r)+TINY)*(1.0+(*r)+TINY)));Equation (14.5.5).*prob=betai(0.5*df,0.5,df/(df+t*t));Student’s t probability./**prob=erfcc(fabs((*z)*sqrt(n-1.0))/1.4142136)*/For large n, this easier computation of prob, using the short routine erfcc, would give approximately the same value.}.















