Doxygen Source Code Documentation
ibinom.c File Reference
#include "mrilib.h"Go to the source code of this file.
| Defines | |
| #define | BAD(str) ( fprintf(stderr,"Bad value of %s\n",str) , exit(1) ) | 
| Functions | |
| int | main (int argc, char *argv[]) | 
Define Documentation
| 
 | 
| 
 | 
Function Documentation
| 
 | ||||||||||||
| \** File : SUMA.c 
 Input paramters : 
 
 
 Definition at line 3 of file ibinom.c. References argc, BAD, binomial_p2t(), strtod(), and tt. 
 00004 {
00005    double qq , nn , pp , tt ;
00006 
00007    if( argc < 4 || strcmp(argv[1],"-help")==0 ){
00008       printf("Usage: ibinom Q N p\n"
00009              "  Q = upper tail probability\n"
00010              "  N = number of trials\n"
00011              "  p = probability of success per trial\n"
00012              "Output is value 'm' such that the binomial probability\n"
00013              "of getting m or more successes in N trials is Q.\n"
00014             ) ;
00015       exit(0) ;
00016    }
00017 
00018    qq = strtod( argv[1] , NULL ) ;
00019    nn = strtod( argv[2] , NULL ) ;
00020    pp = strtod( argv[3] , NULL ) ;
00021 
00022 #define BAD(str) ( fprintf(stderr,"Bad value of %s\n",str) , exit(1) )
00023 
00024    if( qq <= 0.0 || qq >= 1.0 ) BAD("Q") ;
00025    if( nn <= 1.0 )              BAD("N") ;
00026    if( pp <= 0.0 || pp >= 1.0 ) BAD("p") ;
00027 
00028    tt = binomial_p2t( qq , nn , pp ) ;
00029    printf("threshold = %g\n",tt) ;
00030    exit(0) ;
00031 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  