正在加载图片...
616 Chapter 14.Statistical Description of Data Student's t-test for Significantly Different Means Applying the concept of standard error,the conventional statistic for measuring the significance of a difference of means is termed Student's t.When the two distributions are thought to have the same variance,but possibly different means, then Student's t is computed as follows:First,estimate the standard error of the difference of the means,sp,from the"pooled variance"by the formula CeA(c:-EA2+∑eB(1-B2 SD (14.2.1) NA+NB-2 NB where each sum is over the points in one sample,the first or second,each mean likewise refers to one sample or the other,and NA and NB are the numbers of points 套 in the first and second samples,respectively.Second,compute t by t=工A-B (14.2.2) 令 SD Third.evaluate the significance of this value of t for Student's distribution with Press. NA+NB -2 degrees of freedom,by equations (6.4.7)and(6.4.9),and by the routine betai (incomplete beta function)of 86.4. The significance is a number between zero and one,and is the probability that t could be this large or larger just by chance,for distributions with equal means. Therefore,a small numerical value of the significance(0.05 or 0.01)means that the SCIENTIFIC observed difference is "very significant."The function A(t)in equation(6.4.7) 6 is one minus the significance As a routine,we have #include <math.h> 1920 COMPUTING (ISBN void ttest(float datal[],unsigned long n1,float data2[],unsigned long n2, float *t,float *prob) 10.621 Given the arrays data1[1..n1]and data2[1..n2],this routine returns Student's t as t, Numerica and its significance as prob,small values of prob indicating that the arrays have significantly uction Recipes 43108 different means.The data arrays are assumed to be drawn from populations with the same true variance. (outside void avevar(float data[],unsigned long n,float *ave,float *var); float betai(float a,float b,float x); Software. float var1,var2,svar,df,ave1,ave2; North ying of avevar(datal,n1,&ave1,&var1); avevar(data2,n2,&ave2,&var2); df=n1+n2-2; Degrees of freedom. svar=((n1-1)*var1+(n2-1)*var2)/df; Pooled variance. *t=(ave1-ave2)/sgrt(svar*(1.0/n1+1.0/n2)) *prob=betai(0.5*df,0.5,df/(df+(*t)(*t))); See equation (6.4.9). which makes use of the following routine for computing the mean and variance of a set of numbers.616 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). Student’s t-test for Significantly Different Means Applying the concept of standard error, the conventional statistic for measuring the significance of a difference of means is termed Student’s t. When the two distributions are thought to have the same variance, but possibly different means, then Student’s t is computed as follows: First, estimate the standard error of the difference of the means, sD, from the “pooled variance” by the formula sD =  i∈A(xi − xA)2 + i∈B(xi − xB)2 NA + NB − 2 1 NA + 1 NB  (14.2.1) where each sum is over the points in one sample, the first or second, each mean likewise refers to one sample or the other, and NA and NB are the numbers of points in the first and second samples, respectively. Second, compute t by t = xA − xB sD (14.2.2) Third, evaluate the significance of this value of t for Student’s distribution with NA + NB − 2 degrees of freedom, by equations (6.4.7) and (6.4.9), and by the routine betai (incomplete beta function) of §6.4. The significance is a number between zero and one, and is the probability that |t| could be this large or larger just by chance, for distributions with equal means. Therefore, a small numerical value of the significance (0.05 or 0.01) means that the observed difference is “very significant.” The function A(t|ν) in equation (6.4.7) is one minus the significance. As a routine, we have #include <math.h> void ttest(float data1[], unsigned long n1, float data2[], unsigned long n2, float *t, float *prob) Given the arrays data1[1..n1] and data2[1..n2], this routine returns Student’s t as t, and its significance as prob, small values of prob indicating that the arrays have significantly different means. The data arrays are assumed to be drawn from populations with the same true variance. { void avevar(float data[], unsigned long n, float *ave, float *var); float betai(float a, float b, float x); float var1,var2,svar,df,ave1,ave2; avevar(data1,n1,&ave1,&var1); avevar(data2,n2,&ave2,&var2); df=n1+n2-2; Degrees of freedom. svar=((n1-1)*var1+(n2-1)*var2)/df; Pooled variance. *t=(ave1-ave2)/sqrt(svar*(1.0/n1+1.0/n2)); *prob=betai(0.5*df,0.5,df/(df+(*t)*(*t))); See equation (6.4.9). } which makes use of the following routine for computing the mean and variance of a set of numbers,
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有