c14-3 (Numerical Recipes in C), страница 3
Описание файла
Файл "c14-3" внутри архива находится в папке "Numerical Recipes in C". PDF-файл из архива "Numerical Recipes in C", который расположен в категории "". Всё это находится в предмете "цифровая обработка сигналов (цос)" из 8 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "цифровая обработка сигналов" в общих файлах.
Просмотр PDF-файла онлайн
Текст 3 страницы из PDF
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).sort(n1,data1);sort(n2,data2);en1=n1;en2=n2;*d=0.0;while (j1 <= n1 && j2 <= n2) {if ((d1=data1[j1]) <= (d2=data2[j2])) fn1=j1++/en1;if (d2 <= d1) fn2=j2++/en2;if ((dt=fabs(fn2-fn1)) > *d) *d=dt;}en=sqrt(en1*en2/(en1+en2));*prob=probks((en+0.12+0.11/en)*(*d));62714.3 Are Two Distributions Different?Unfortunately, there is no simple formula analogous to equations (14.3.7) and (14.3.9) for thisstatistic, although Noé [5] gives a computational method using a recursion relation and providesa graph of numerical results.
There are many other possible similar statistics, for exampleZ 1|SN (x) − P (x)|pD** =dP (x)(14.3.12)P (x)[1 − P (x)]P =0V = D+ + D− =max−∞<x<∞[SN (x) − P (x)] +max−∞<x<∞[P (x) − SN (x)](14.3.13)is the sum of the maximum distance of SN (x) above and below P (x). You should be ableto convince yourself that this statistic has the desired invariance on the circle: Sketch theindefinite integral of two probability distributions defined on the circle as a function of anglearound the circle, as the angle goes through several times 360◦ . If you change the startingpoint of the integration, D+ and D− change individually, but their sum is constant.Furthermore, there is a simple formula for the asymptotic distribution of the statistic V ,directly analogous to equations (14.3.7)–(14.3.10).
Let∞X2 2QKP (λ) = 2(4j 2 λ2 − 1)e−2j λ(14.3.14)j=1which is monotonic and satisfiesQKP (0) = 1QKP (∞) = 0In terms of this function the significance level is [1]h√ i√Probability (V > observed ) = QKPNe + 0.155 + 0.24/ Ne D(14.3.15)(14.3.16)Here Ne is N in the one-sample case, or is given by equation (14.3.10) in the case oftwo samples.Of course, Kuiper’s test is ideal for any problem originally defined on a circle, forexample, to test whether the distribution in longitude of something agrees with some theory,or whether two somethings have different distributions in longitude.
(See also [8].)We will leave to you the coding of routines analogous to ksone, kstwo, and probks,above. (For λ < 0.4, don’t try to do the sum 14.3.14. Its value is 1, to 7 figures, but the seriescan require many terms to converge, and loses accuracy to roundoff.)Two final cautionary notes: First, we should mention that all varieties of K–S test lackthe ability to discriminate some kinds of distributions.
A simple example is a probabilitydistribution with a narrow “notch” within which the probability falls to zero. Such adistribution is of course ruled out by the existence of even one data point within the notch,but, because of its cumulative nature, a K–S test would require many data points in the notchbefore signaling a discrepancy.Second, we should note that, if you estimate any parameters from a data set (e.g., a meanand variance), then the distribution of the K–S statistic D for a cumulative distribution functionP (x) that uses the estimated parameters is no longer given by equation (14.3.9). In general,you will have to determine the new distribution yourself, e.g., by Monte Carlo methods.CITED REFERENCES AND FURTHER READING:von Mises, R. 1964, Mathematical Theory of Probability and Statistics (New York: AcademicPress), Chapters IX(C) and IX(E).Sample 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).which is also discussed by Anderson and Darling (see [3]).Another approach, which we prefer as simpler and more direct, is due to Kuiper [6,7].We already mentioned that the standard K–S test is invariant under reparametrizations of thevariable x.
An even more general symmetry, which guarantees equal sensitivities at all valuesof x, is to wrap the x axis around into a circle (identifying the points at ±∞), and to look fora statistic that is now invariant under all shifts and parametrizations on the circle. This allows,for example, a probability distribution to be “cut” at some central value of x, and the left andright halves to be interchanged, without altering the statistic or its significance.Kuiper’s statistic, defined as628Chapter 14.Statistical Description of DataStephens, M.A. 1970, Journal of the Royal Statistical Society, ser. B, vol. 32, pp. 115–122.
[1]Anderson, T.W., and Darling, D.A. 1952, Annals of Mathematical Statistics, vol. 23, pp. 193–212.[2]Darling, D.A. 1957, Annals of Mathematical Statistics, vol. 28, pp. 823–838. [3]Michael, J.R. 1983, Biometrika, vol. 70, no. 1, pp. 11–17. [4]Stephens, M.A. 1965, Biometrika, vol. 52, pp. 309–321.
[7]Fisher, N.I., Lewis, T., and Embleton, B.J.J. 1987, Statistical Analysis of Spherical Data (NewYork: Cambridge University Press). [8]14.4 Contingency Table Analysis of TwoDistributionsIn this section, and the next two sections, we deal with measures of associationfor two distributions. The situation is this: Each data point has two or moredifferent quantities associated with it, and we want to know whether knowledge ofone quantity gives us any demonstrable advantage in predicting the value of anotherquantity. In many cases, one variable will be an “independent” or “control” variable,and another will be a “dependent” or “measured” variable.
Then, we want to know ifthe latter variable is in fact dependent on or associated with the former variable. If itis, we want to have some quantitative measure of the strength of the association. Oneoften hears this loosely stated as the question of whether two variables are correlatedor uncorrelated, but we will reserve those terms for a particular kind of association(linear, or at least monotonic), as discussed in §14.5 and §14.6.Notice that, as in previous sections, the different concepts of significance andstrength appear: The association between two distributions may be very significanteven if that association is weak — if the quantity of data is large enough.It is useful to distinguish among some different kinds of variables, withdifferent categories forming a loose hierarchy.• A variable is called nominal if its values are the members of someunordered set.
For example, “state of residence” is a nominal variablethat (in the U.S.) takes on one of 50 values; in astrophysics, “type ofgalaxy” is a nominal variable with the three values “spiral,” “elliptical,”and “irregular.”• A variable is termed ordinal if its values are the members of a discrete, butordered, set. Examples are: grade in school, planetary order from the Sun(Mercury = 1, Venus = 2, . .
.), number of offspring. There need not beany concept of “equal metric distance” between the values of an ordinalvariable, only that they be intrinsically ordered.• We will call a variable continuous if its values are real numbers, asare times, distances, temperatures, etc. (Social scientists sometimesdistinguish between interval and ratio continuous variables, but we do notfind that distinction very compelling.)Sample 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).Noé, M. 1972, Annals of Mathematical Statistics, vol. 43, pp. 58–64. [5]Kuiper, N.H. 1962, Proceedings of the Koninklijke Nederlandse Akademie van Wetenschappen,ser. A., vol. 63, pp.
38–47. [6].