正在加载图片...
648 Chapter 14.Statistical Description of Data *d1=FMAX(*d1,fabs(fd-gd)); For both the sample and the model,the distribution is integrated in each of four quadrants,and the maximum difference is saved. pearsn(x1,y1,n1,&r1,&dum,&dumm); Get the linear correlation coefficient r1. sqen=sqrt((double)n1); rr=sqrt(1.0-r1*r1); Estimate the probability using the K-S probability function probks *prob=probks(*d1*sqen/(1.0+rr*(0.25-0.75/sqen))); http://www.nr. void quadct(float x,float y,float xx[,float yy],unsigned long nn, 83g float *fa,float *fb,float *fc,float *fd) Given an origin (x,y),and an array of nn points with coordinates xx[1..nn]and yy [1..nn] granted for 19881992 count how many of them are in each quadrant around the origin,and return the normalized fractions.Quadrants are labeled alphabetically,counterclockwise from the upper right.Used 100 by ks2d1s and ks2d2s. unsigned long k,na,nb,nc,nd; 7423 float ff; to to users to make one paper by Cambridge University Press. from NUMERICAL RECIPES IN C: na=nb=nc-nd=0; for (k=1;k<=nn;k++){ if (yy[k]>y){ xx[k]>x?++na:++nb; (North America THE else xx[k]>x?++nd:++nc; ART Programs ff=1.0/nn; *fa-ff*na; send copy for thei *fb=ff*nb; *fc=ff*nc; *fd=ff*nd; email to directcustsen OF SCIENTIFIC COMPUTING(ISBN 0-521- #include "nrutil.h" void quadvl(float x,float y,float *fa,float *fb,float *fc,float *fd) v@cambr This is a sample of a user-supplied routine to be used with ks2d1s.In this case,the model distribution is uniform inside the square-1<x<1,-1 <y<1.In general this routine 1988-1992 by Numerical Recipes should return,for any point (x,y).the fraction of the total distribution in each of the four -43106 quadrants around that point.The fractions,fa,fb,fc,and fd,must add up to 1.Quadrants are alphabetical,counterclockwise from the upper right. (outside float qa,qb,qc,qd; Software. qa=FMIW(2.0,FNAX(0.0,1.0-x)); ying of qb=FHIW(2.0,FNAX(0.0,1.0-y)); qc=FMTW(2.0,FHAX(0.0,x+1.0)); qd=FMIN(2.0,FNAX(0.0,y+1.0)); *fa=0.25*ga*gb; *fb=0.25*qb*qc; *fc=0.25*qc*qd *fd=0.25*gd*ga; The routine ks2d2s is the two-sample case of the two-dimensional K-S test.It also calls quadct,pearsn,and probks.Being a two-sample test,it does not need an analytic model.648 Chapter 14. Statistical Description of Data Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). *d1=FMAX(*d1,fabs(fd-gd)); For both the sample and the model, the distribution is integrated in each of four quadrants, and the maximum difference is saved. } pearsn(x1,y1,n1,&r1,&dum,&dumm); Get the linear correlation coefficient r1. sqen=sqrt((double)n1); rr=sqrt(1.0-r1*r1); Estimate the probability using the K-S probability function probks. *prob=probks(*d1*sqen/(1.0+rr*(0.25-0.75/sqen))); } void quadct(float x, float y, float xx[], float yy[], unsigned long nn, float *fa, float *fb, float *fc, float *fd) Given an origin (x, y), and an array of nn points with coordinates xx[1..nn] and yy[1..nn], count how many of them are in each quadrant around the origin, and return the normalized fractions. Quadrants are labeled alphabetically, counterclockwise from the upper right. Used by ks2d1s and ks2d2s. { unsigned long k,na,nb,nc,nd; float ff; na=nb=nc=nd=0; for (k=1;k<=nn;k++) { if (yy[k] > y) { xx[k] > x ? ++na : ++nb; } else { xx[k] > x ? ++nd : ++nc; } } ff=1.0/nn; *fa=ff*na; *fb=ff*nb; *fc=ff*nc; *fd=ff*nd; } #include "nrutil.h" void quadvl(float x, float y, float *fa, float *fb, float *fc, float *fd) This is a sample of a user-supplied routine to be used with ks2d1s. In this case, the model distribution is uniform inside the square −1 <x< 1, −1 <y< 1. In general this routine should return, for any point (x, y), the fraction of the total distribution in each of the four quadrants around that point. The fractions, fa, fb, fc, and fd, must add up to 1. Quadrants are alphabetical, counterclockwise from the upper right. { float qa,qb,qc,qd; qa=FMIN(2.0,FMAX(0.0,1.0-x)); qb=FMIN(2.0,FMAX(0.0,1.0-y)); qc=FMIN(2.0,FMAX(0.0,x+1.0)); qd=FMIN(2.0,FMAX(0.0,y+1.0)); *fa=0.25*qa*qb; *fb=0.25*qb*qc; *fc=0.25*qc*qd; *fd=0.25*qd*qa; } The routine ks2d2s is the two-sample case of the two-dimensional K–S test. It also calls quadct, pearsn, and probks. Being a two-sample test, it does not need an analytic model
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有