int main() { double x, a, b, param; double nu1[1+ 9]; double nu2[1+26]; int i, j; printf("\nProgram for calculating minimal detectable differences "); printf("for general ANOVA models\n"); printf("Copyright (C) 2008, Ali Baharev, All rights reserved.\n"); printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); printf("This is free software, and you are welcome to redistribute it\n"); printf("under certain conditions (GNU GPL).\n\n"); printf("The output of this program is the corrected table of \n"); printf("Lorenzen and Anderson (1993) Appendix 12, p. 374\n\n"); for (i=1; i<=6; ++i) nu1[i] = i; nu1[7] = 10; nu1[8] = 20; nu1[9] = 50; for (i=1; i<=8; ++i) nu2[i] = i; for (i=9; i<=19; ++i) nu2[i] = 2*i-8; for (i=20; i<=23; ++i) nu2[i] = 20*(i-18); nu2[24] = 200; nu2[25] = 500; nu2[26] = 1000; for (j=1; j<=26; ++j) { for (i=1; i<=9; ++i) { a = nu1[i]/2.0; b = nu2[j]/2.0; /* Type I error probability 0.05 Type II error probability 0.10 */ x = qbeta(0.95, a, b, 1, 0); param = sqrt( ncbeta( 0.10, x, a, b)/nu1[i]); printf("%f\t", param); } printf("\n"); } return 0; }
void test01 ( ) /******************************************************************************/ /* Purpose: TEST01 demonstrates the use of NCBETA. Licensing: This code is distributed under the GNU LGPL license. Modified: 20 November 2010 Author: John Burkardt */ { double a; double b; double errmax = 1.0E-10; double fx; double fx2; int ifault; double lambda; int n_data; double x; printf ( "\n" ); printf ( "TEST01:\n" ); printf ( " NCBETA computes the noncentral incomplete Beta function.\n" ); printf ( " Compare to tabulated values.\n" ); printf ( "\n" ); printf ( " A B LAMBDA X " ); printf ( " FX FX2\n" ); printf ( " " ); printf ( " (Tabulated) (NCBETA) DIFF\n" ); printf ( "\n" ); n_data = 0; for ( ; ; ) { beta_noncentral_cdf_values ( &n_data, &a, &b, &lambda, &x, &fx ); if ( n_data == 0 ) { break; } fx2 = ncbeta ( a, b, lambda, x, errmax, &ifault ); printf ( " %7.2f %7.2f %7.3f %10.4f %24.16f %24.16f %10.4e\n", a, b, lambda, x, fx, fx2, fabs ( fx - fx2 ) ); } return; }