home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / VideoToolboxSources / Binomial.c < prev    next >
MacBinary  |  1995-07-19  |  8.9 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: Binomial.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Jul 19 19:50:19 1995, modified Wed Jul 19 19:50:19 1995, creator 'CWIE', type ASCII, 8169 bytes "Binomial.c" , at 0x2069 714 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 42 69 6e 6f 6d 69 | 61 6c 2e 63 00 00 00 00 |..Binomi|al.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 1f e9 00 | 00 02 ca ac 33 4a bb ac |........|....3J..|
|00000060| 33 4a bb 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |3J......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 82 0d 00 00 |........|........|
|00000080| 2f 2a 0d 42 69 6e 6f 6d | 69 61 6c 2e 63 0d 43 6f |/*.Binom|ial.c.Co|
|00000090| 70 79 72 69 67 68 74 20 | 28 63 29 20 31 39 39 30 |pyright |(c) 1990|
|000000a0| 2c 31 39 39 31 2c 31 39 | 39 32 2c 31 39 39 34 20 |,1991,19|92,1994 |
|000000b0| 44 65 6e 69 73 20 47 2e | 20 50 65 6c 6c 69 0d 0d |Denis G.| Pelli..|
|000000c0| 56 61 72 69 6f 75 73 20 | 72 6f 75 74 69 6e 65 73 |Various |routines|
|000000d0| 20 74 68 61 74 20 64 65 | 61 6c 20 77 69 74 68 20 | that de|al with |
|000000e0| 42 69 6e 6f 6d 69 61 6c | 20 73 74 61 74 69 73 74 |Binomial| statist|
|000000f0| 69 63 73 2c 20 69 6e 63 | 6c 75 64 69 6e 67 20 67 |ics, inc|luding g|
|00000100| 65 6e 65 72 61 74 69 6e | 67 20 72 61 6e 64 6f 6d |eneratin|g random|
|00000110| 0d 73 61 6d 70 6c 65 73 | 20 61 6e 64 20 63 6f 6d |.samples| and com|
|00000120| 70 75 74 69 6e 67 20 63 | 6f 6e 66 69 64 65 6e 63 |puting c|onfidenc|
|00000130| 65 20 69 6e 74 65 72 76 | 61 6c 73 2e 0d 0d 54 68 |e interv|als...Th|
|00000140| 69 73 20 66 69 6c 65 20 | 63 6f 6e 74 61 69 6e 73 |is file |contains|
|00000150| 20 74 77 6f 20 67 65 6e | 65 72 61 74 69 6f 6e 73 | two gen|erations|
|00000160| 20 6f 66 20 72 6f 75 74 | 69 6e 65 73 20 74 68 61 | of rout|ines tha|
|00000170| 74 20 67 65 6e 65 72 61 | 74 65 20 63 6f 6e 66 69 |t genera|te confi|
|00000180| 64 65 6e 63 65 0d 69 6e | 74 65 72 76 61 6c 73 2e |dence.in|tervals.|
|00000190| 20 54 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 72 6f | The ori|ginal ro|
|000001a0| 75 74 69 6e 65 73 20 42 | 69 6e 6f 6d 69 61 6c 55 |utines B|inomialU|
|000001b0| 70 70 65 72 42 6f 75 6e | 64 20 61 6e 64 20 42 69 |pperBoun|d and Bi|
|000001c0| 6e 6f 6d 69 61 6c 4c 6f | 77 65 72 42 6f 75 6e 64 |nomialLo|werBound|
|000001d0| 20 61 72 65 0d 6f 6c 64 | 2c 20 62 75 74 20 61 72 | are.old|, but ar|
|000001e0| 65 20 6d 6f 72 65 20 72 | 6f 62 75 73 74 2e 20 54 |e more r|obust. T|
|000001f0| 68 65 20 6e 65 77 20 72 | 6f 75 74 69 6e 65 73 20 |he new r|outines |
|00000200| 61 72 65 20 62 61 73 65 | 64 20 6f 6e 20 61 20 4e |are base|d on a N|
|00000210| 75 6d 65 72 69 63 61 6c | 20 52 65 63 69 70 65 73 |umerical| Recipes|
|00000220| 20 69 6e 20 43 0d 72 6f | 75 74 69 6e 65 20 74 6f | in C.ro|utine to|
|00000230| 20 63 6f 6d 70 75 74 65 | 20 74 68 65 20 69 6e 63 | compute| the inc|
|00000240| 6f 6d 70 6c 65 74 65 20 | 62 65 74 61 20 66 75 6e |omplete |beta fun|
|00000250| 63 74 69 6f 6e 2e 20 54 | 68 65 20 6e 65 77 20 72 |ction. T|he new r|
|00000260| 6f 75 74 69 6e 65 73 20 | 61 64 64 20 6c 69 74 74 |outines |add litt|
|00000270| 6c 65 20 74 6f 0d 74 68 | 65 20 6f 6c 64 20 72 6f |le to.th|e old ro|
|00000280| 75 74 69 6e 65 73 2c 20 | 61 6e 64 20 72 65 71 75 |utines, |and requ|
|00000290| 69 72 65 20 74 68 65 20 | 4e 75 6d 65 72 69 63 61 |ire the |Numerica|
|000002a0| 6c 20 52 65 63 69 70 65 | 73 20 69 6e 20 43 2c 20 |l Recipe|s in C, |
|000002b0| 73 6f 20 49 20 63 6f 6d | 6d 65 6e 74 65 64 20 74 |so I com|mented t|
|000002c0| 68 65 6d 0d 6f 75 74 2e | 20 0d 0d 41 6c 73 6f 20 |hem.out.| ..Also |
|000002d0| 73 65 65 3a 20 43 68 69 | 53 71 75 61 72 65 2e 63 |see: Chi|Square.c|
|000002e0| 2c 20 45 78 70 6f 6e 65 | 6e 74 69 61 6c 2e 63 2c |, Expone|ntial.c,|
|000002f0| 20 4e 6f 72 6d 61 6c 2e | 63 2c 20 55 6e 69 66 6f | Normal.|c, Unifo|
|00000300| 72 6d 2e 63 0d 0d 48 49 | 53 54 4f 52 59 3a 0d 31 |rm.c..HI|STORY:.1|
|00000310| 2f 35 2f 39 31 20 41 64 | 64 65 64 20 6e 65 77 20 |/5/91 Ad|ded new |
|00000320| 62 69 6e 6f 6d 69 61 6c | 20 72 6f 75 74 69 6e 65 |binomial| routine|
|00000330| 73 2e 20 54 68 65 73 65 | 20 72 6f 75 74 69 6e 65 |s. These| routine|
|00000340| 73 20 6d 61 79 20 62 65 | 20 0d 09 09 63 6f 6d 6d |s may be| ...comm|
|00000350| 65 6e 74 65 64 20 6f 75 | 74 20 62 79 20 73 65 74 |ented ou|t by set|
|00000360| 74 69 6e 67 20 4e 45 57 | 5f 42 49 4e 4f 4d 49 41 |ting NEW|_BINOMIA|
|00000370| 4c 20 74 6f 20 7a 65 72 | 6f 2e 0d 31 2f 37 2f 39 |L to zer|o..1/7/9|
|00000380| 31 20 52 65 77 72 6f 74 | 65 20 42 69 6e 6f 6d 69 |1 Rewrot|e Binomi|
|00000390| 61 6c 55 70 70 65 72 42 | 6f 75 6e 64 20 26 20 42 |alUpperB|ound & B|
|000003a0| 69 6e 6f 6d 69 61 6c 4c | 6f 77 65 72 42 6f 75 6e |inomialL|owerBoun|
|000003b0| 64 20 74 6f 20 61 6c 6c | 6f 77 20 73 70 65 63 69 |d to all|ow speci|
|000003c0| 66 69 63 61 74 69 6f 6e | 20 6f 66 20 74 68 65 0d |fication| of the.|
|000003d0| 09 09 64 65 73 69 72 65 | 64 20 63 6f 6e 66 69 64 |..desire|d confid|
|000003e0| 65 6e 63 65 20 6f 66 20 | 74 68 65 20 69 6e 74 65 |ence of |the inte|
|000003f0| 72 76 61 6c 2e 0d 34 2f | 32 34 2f 39 32 09 64 67 |rval..4/|24/92.dg|
|00000400| 70 09 41 64 64 65 64 20 | 42 69 6e 6f 6d 69 61 6c |p.Added |Binomial|
|00000410| 53 61 6d 70 6c 65 51 75 | 69 63 6b 6c 79 28 29 2e |SampleQu|ickly().|
|00000420| 0d 34 2f 32 37 2f 39 32 | 09 64 67 70 09 4f 6f 70 |.4/27/92|.dgp.Oop|
|00000430| 73 2e 20 49 20 6a 75 73 | 74 20 6e 6f 74 69 63 65 |s. I jus|t notice|
|00000440| 64 20 74 68 61 74 20 74 | 68 69 73 20 66 69 6c 65 |d that t|his file|
|00000450| 20 77 61 73 20 61 6c 77 | 61 79 73 20 69 6e 63 6c | was alw|ays incl|
|00000460| 75 64 69 6e 67 20 6e 72 | 2e 68 2c 20 77 68 69 63 |uding nr|.h, whic|
|00000470| 68 20 79 6f 75 27 64 0d | 09 09 09 6f 6e 6c 79 20 |h you'd.|...only |
|00000480| 68 61 76 65 20 69 66 20 | 79 6f 75 20 6f 77 6e 20 |have if |you own |
|00000490| 74 68 65 20 4e 75 6d 65 | 72 69 63 61 6c 20 52 65 |the Nume|rical Re|
|000004a0| 63 69 70 65 73 2e 20 49 | 20 6d 6f 76 65 64 20 74 |cipes. I| moved t|
|000004b0| 68 65 20 69 6e 63 6c 75 | 64 65 20 73 74 61 74 65 |he inclu|de state|
|000004c0| 6d 65 6e 74 0d 09 09 09 | 64 6f 77 6e 20 69 6e 73 |ment....|down ins|
|000004d0| 69 64 65 20 74 68 65 20 | 63 6f 6e 64 69 74 69 6f |ide the |conditio|
|000004e0| 6e 61 6c 20 62 65 6c 6f | 77 2c 20 77 68 65 72 65 |nal belo|w, where|
|000004f0| 20 69 74 20 62 65 6c 6f | 6e 67 73 2e 20 0d 2a 2f | it belo|ngs. .*/|
|00000500| 0d 23 69 6e 63 6c 75 64 | 65 20 22 56 69 64 65 6f |.#includ|e "Video|
|00000510| 54 6f 6f 6c 62 6f 78 2e | 68 22 0d 0d 23 64 65 66 |Toolbox.|h"..#def|
|00000520| 69 6e 65 20 4e 45 57 5f | 42 49 4e 4f 4d 49 41 4c |ine NEW_|BINOMIAL|
|00000530| 20 30 0d 0d 6c 6f 6e 67 | 20 42 69 6e 6f 6d 69 61 | 0..long| Binomia|
|00000540| 6c 53 61 6d 70 6c 65 28 | 64 6f 75 62 6c 65 20 70 |lSample(|double p|
|00000550| 2c 6c 6f 6e 67 20 6e 29 | 0d 2f 2a 0d 52 65 74 75 |,long n)|./*.Retu|
|00000560| 72 6e 73 20 61 20 61 20 | 73 61 6d 70 6c 65 20 66 |rns a a |sample f|
|00000570| 72 6f 6d 20 61 20 62 69 | 6e 6f 6d 69 61 6c 20 64 |rom a bi|nomial d|
|00000580| 69 73 74 72 69 62 75 74 | 69 6f 6e 3a 20 6e 75 6d |istribut|ion: num|
|00000590| 62 65 72 20 6f 66 20 68 | 65 61 64 73 20 69 6e 20 |ber of h|eads in |
|000005a0| 6e 20 66 6c 69 70 73 20 | 6f 66 0d 61 20 77 65 69 |n flips |of.a wei|
|000005b0| 67 68 74 65 64 20 63 6f | 69 6e 20 77 69 74 68 20 |ghted co|in with |
|000005c0| 61 20 70 72 6f 62 61 62 | 69 6c 69 74 79 20 70 20 |a probab|ility p |
|000005d0| 6f 66 20 61 20 68 65 61 | 64 20 6f 6e 20 65 61 63 |of a hea|d on eac|
|000005e0| 68 20 66 6c 69 70 2e 20 | 54 68 69 73 20 69 73 20 |h flip. |This is |
|000005f0| 66 69 6e 65 20 69 66 20 | 6e 20 69 73 20 73 6d 61 |fine if |n is sma|
|00000600| 6c 6c 2e 20 48 6f 77 65 | 76 65 72 2c 0d 69 66 20 |ll. Howe|ver,.if |
|00000610| 6e 20 69 73 20 6c 61 72 | 67 65 2c 20 65 2e 67 2e |n is lar|ge, e.g.|
|00000620| 20 6e 3e 31 30 30 2c 20 | 74 68 65 6e 20 74 68 69 | n>100, |then thi|
|00000630| 73 20 72 6f 75 74 69 6e | 65 20 77 69 6c 6c 20 62 |s routin|e will b|
|00000640| 65 20 72 61 74 68 65 72 | 20 73 6c 6f 77 2c 20 61 |e rather| slow, a|
|00000650| 6e 64 20 79 6f 75 20 6d | 61 79 20 70 72 65 66 65 |nd you m|ay prefe|
|00000660| 72 0d 74 6f 20 75 73 65 | 20 74 68 65 20 6d 6f 72 |r.to use| the mor|
|00000670| 65 20 65 6c 61 62 6f 72 | 61 74 65 20 4e 75 6d 65 |e elabor|ate Nume|
|00000680| 72 69 63 61 6c 20 52 65 | 63 69 70 65 73 20 62 6e |rical Re|cipes bn|
|00000690| 6c 64 65 76 28 29 20 72 | 6f 75 74 69 6e 65 2e 0d |ldev() r|outine..|
|000006a0| 2a 2f 0d 7b 0d 09 6c 6f | 6e 67 20 6b 2c 69 3b 0d |*/.{..lo|ng k,i;.|
|000006b0| 0d 09 6b 3d 30 3b 0d 09 | 66 6f 72 28 69 3d 30 3b |..k=0;..|for(i=0;|
|000006c0| 69 3c 6e 3b 69 2b 2b 29 | 20 69 66 28 70 3e 55 6e |i<n;i++)| if(p>Un|
|000006d0| 69 66 6f 72 6d 53 61 6d | 70 6c 65 28 29 29 6b 2b |iformSam|ple())k+|
|000006e0| 2b 3b 0d 09 72 65 74 75 | 72 6e 20 6b 3b 0d 7d 0d |+;..retu|rn k;.}.|
|000006f0| 0d 69 6e 74 20 42 69 6e | 6f 6d 69 61 6c 53 61 6d |.int Bin|omialSam|
|00000700| 70 6c 65 51 75 69 63 6b | 6c 79 28 69 6e 74 20 6e |pleQuick|ly(int n|
|00000710| 29 0d 2f 2a 0d 44 6f 65 | 73 20 6e 20 66 6c 69 70 |)./*.Doe|s n flip|
|00000720| 73 20 6f 66 20 61 6e 20 | 75 6e 77 65 69 67 68 74 |s of an |unweight|
|00000730| 65 64 20 63 6f 69 6e 20 | 61 6e 64 20 72 65 74 75 |ed coin |and retu|
|00000740| 72 6e 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |rns the |number o|
|00000750| 66 20 68 65 61 64 73 2e | 20 56 65 72 79 20 66 61 |f heads.| Very fa|
|00000760| 73 74 20 69 66 20 6e 3c | 31 30 30 30 2e 20 0d 46 |st if n<|1000. .F|
|00000770| 6f 72 20 6c 61 72 67 65 | 72 20 6e 20 69 74 20 77 |or large|r n it w|
|00000780| 6f 75 6c 64 20 62 65 20 | 66 61 73 74 65 72 20 74 |ould be |faster t|
|00000790| 6f 20 75 73 65 20 62 6e | 6c 64 65 76 28 29 2e 0d |o use bn|ldev()..|
|000007a0| 2a 2f 0d 7b 0d 09 72 65 | 67 69 73 74 65 72 20 69 |*/.{..re|gister i|
|000007b0| 6e 74 20 69 2c 6b 3d 30 | 3b 0d 09 72 65 67 69 73 |nt i,k=0|;..regis|
|000007c0| 74 65 72 20 73 68 6f 72 | 74 20 72 3b 0d 09 0d 09 |ter shor|t r;....|
|000007d0| 66 6f 72 28 69 3d 6e 3b | 69 3e 3d 38 3b 69 2d 3d |for(i=n;|i>=8;i-=|
|000007e0| 38 29 7b 0d 09 09 72 3d | 72 61 6e 64 55 28 29 3b |8){...r=|randU();|
|000007f0| 09 2f 2a 20 55 73 65 20 | 6f 6e 6c 79 20 74 68 65 |./* Use |only the|
|00000800| 20 75 70 70 65 72 20 38 | 20 62 69 74 73 2c 20 77 | upper 8| bits, w|
|00000810| 68 69 63 68 20 61 72 65 | 20 72 65 70 75 74 65 64 |hich are| reputed|
|00000820| 20 74 6f 20 62 65 20 6d | 6f 72 65 20 72 61 6e 64 | to be m|ore rand|
|00000830| 6f 6d 2e 20 2a 2f 0d 09 | 09 69 66 28 72 3c 30 29 |om. */..|.if(r<0)|
|00000840| 6b 2b 2b 3b 0d 09 09 72 | 3c 3c 3d 31 3b 0d 09 09 |k++;...r|<<=1;...|
|00000850| 69 66 28 72 3c 30 29 6b | 2b 2b 3b 0d 09 09 72 3c |if(r<0)k|++;...r<|
|00000860| 3c 3d 31 3b 0d 09 09 69 | 66 28 72 3c 30 29 6b 2b |<=1;...i|f(r<0)k+|
|00000870| 2b 3b 0d 09 09 72 3c 3c | 3d 31 3b 0d 09 09 69 66 |+;...r<<|=1;...if|
|00000880| 28 72 3c 30 29 6b 2b 2b | 3b 0d 09 09 72 3c 3c 3d |(r<0)k++|;...r<<=|
|00000890| 31 3b 0d 09 09 69 66 28 | 72 3c 30 29 6b 2b 2b 3b |1;...if(|r<0)k++;|
|000008a0| 0d 09 09 72 3c 3c 3d 31 | 3b 0d 09 09 69 66 28 72 |...r<<=1|;...if(r|
|000008b0| 3c 30 29 6b 2b 2b 3b 0d | 09 09 72 3c 3c 3d 31 3b |<0)k++;.|..r<<=1;|
|000008c0| 0d 09 09 69 66 28 72 3c | 30 29 6b 2b 2b 3b 0d 09 |...if(r<|0)k++;..|
|000008d0| 09 72 3c 3c 3d 31 3b 0d | 09 09 69 66 28 72 3c 30 |.r<<=1;.|..if(r<0|
|000008e0| 29 6b 2b 2b 3b 0d 09 09 | 72 3c 3c 3d 31 3b 0d 09 |)k++;...|r<<=1;..|
|000008f0| 7d 0d 09 69 66 28 69 3e | 30 29 7b 0d 09 09 72 3d |}..if(i>|0){...r=|
|00000900| 72 61 6e 64 55 28 29 3b | 0d 09 09 66 6f 72 28 3b |randU();|...for(;|
|00000910| 69 3e 30 3b 69 2d 2d 29 | 7b 0d 09 09 09 69 66 28 |i>0;i--)|{....if(|
|00000920| 72 3c 30 29 6b 2b 2b 3b | 0d 09 09 09 72 3c 3c 3d |r<0)k++;|....r<<=|
|00000930| 31 3b 0d 09 09 7d 0d 09 | 7d 0d 09 72 65 74 75 72 |1;...}..|}..retur|
|00000940| 6e 20 6b 3b 0d 7d 0d 0d | 2f 2a 0d 42 69 6e 6f 6d |n k;.}..|/*.Binom|
|00000950| 69 61 6c 55 70 70 65 72 | 42 6f 75 6e 64 20 61 6e |ialUpper|Bound an|
|00000960| 64 20 42 69 6e 6f 6d 69 | 61 6c 4c 6f 77 65 72 42 |d Binomi|alLowerB|
|00000970| 6f 75 6e 64 20 72 65 74 | 75 72 6e 20 61 20 50 20 |ound ret|urn a P |
|00000980| 63 6f 6e 66 69 64 65 6e | 63 65 20 69 6e 74 65 72 |confiden|ce inter|
|00000990| 76 61 6c 20 66 6f 72 20 | 74 68 65 0d 75 6e 64 65 |val for |the.unde|
|000009a0| 72 6c 79 69 6e 67 20 62 | 69 6e 6f 6d 69 61 6c 20 |rlying b|inomial |
|000009b0| 70 72 6f 62 61 62 69 6c | 69 74 79 20 61 73 73 75 |probabil|ity assu|
|000009c0| 6d 65 64 20 74 6f 20 68 | 61 76 65 20 67 65 6e 65 |med to h|ave gene|
|000009d0| 72 61 74 65 64 20 74 68 | 65 20 64 61 74 61 2e 0d |rated th|e data..|
|000009e0| 0d 54 68 65 20 66 6f 72 | 6d 75 6c 61 20 69 73 20 |.The for|mula is |
|000009f0| 62 61 73 65 64 20 6f 6e | 20 61 20 47 61 75 73 73 |based on| a Gauss|
|00000a00| 69 61 6e 20 61 70 70 72 | 6f 78 69 6d 61 74 69 6f |ian appr|oximatio|
|00000a10| 6e 2c 20 73 6f 6c 76 69 | 6e 67 20 66 6f 72 20 74 |n, solvi|ng for t|
|00000a20| 68 65 20 70 20 74 68 61 | 74 20 77 69 6c 6c 0d 70 |he p tha|t will.p|
|00000a30| 75 74 20 74 68 65 20 6f | 62 73 65 72 76 65 64 20 |ut the o|bserved |
|00000a40| 72 65 73 75 6c 74 20 74 | 68 65 20 72 69 67 68 74 |result t|he right|
|00000a50| 20 6e 75 6d 62 65 72 20 | 6f 66 20 73 74 61 6e 64 | number |of stand|
|00000a60| 61 72 64 20 64 65 76 69 | 61 74 69 6f 6e 73 20 61 |ard devi|ations a|
|00000a70| 77 61 79 20 66 72 6f 6d | 20 74 68 65 0d 6d 65 61 |way from| the.mea|
|00000a80| 6e 2c 20 70 6c 75 73 20 | 6f 72 20 6d 69 6e 75 73 |n, plus |or minus|
|00000a90| 20 30 2e 35 2c 20 61 73 | 20 61 20 22 63 6f 6e 74 | 0.5, as| a "cont|
|00000aa0| 69 6e 75 69 74 79 20 63 | 6f 72 72 65 63 74 69 6f |inuity c|orrectio|
|00000ab0| 6e 22 2e 0d 0d 54 68 69 | 73 20 69 73 20 74 68 65 |n"...Thi|s is the|
|00000ac0| 20 62 65 73 74 20 66 6f | 72 6d 75 6c 61 20 49 20 | best fo|rmula I |
|00000ad0| 63 6f 75 6c 64 20 66 69 | 6e 64 20 69 6e 20 6c 6f |could fi|nd in lo|
|00000ae0| 6f 6b 69 6e 67 20 74 68 | 72 6f 75 67 68 20 73 65 |oking th|rough se|
|00000af0| 76 65 72 61 6c 20 73 74 | 61 74 69 73 74 69 63 73 |veral st|atistics|
|00000b00| 0d 62 6f 6f 6b 73 2e 20 | 48 6f 77 65 76 65 72 2c |.books. |However,|
|00000b10| 20 74 68 65 20 72 65 73 | 75 6c 74 20 68 61 73 20 | the res|ult has |
|00000b20| 74 6f 20 62 65 20 74 61 | 6b 65 6e 20 77 69 74 68 |to be ta|ken with|
|00000b30| 20 61 20 67 72 61 69 6e | 20 6f 66 20 73 61 6c 74 | a grain| of salt|
|00000b40| 20 62 65 63 61 75 73 65 | 20 69 74 20 69 73 0d 6e | because| it is.n|
|00000b50| 6f 74 20 70 6f 73 73 69 | 62 6c 65 20 74 6f 20 70 |ot possi|ble to p|
|00000b60| 72 6f 64 75 63 65 20 61 | 20 62 69 6e 6f 6d 69 61 |roduce a| binomia|
|00000b70| 6c 20 63 6f 6e 66 69 64 | 65 6e 63 65 20 69 6e 74 |l confid|ence int|
|00000b80| 65 72 76 61 6c 20 74 68 | 61 74 20 77 69 6c 6c 20 |erval th|at will |
|00000b90| 73 61 74 69 73 66 79 20 | 74 68 65 0d 73 74 72 69 |satisfy |the.stri|
|00000ba0| 63 74 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |ct defin|ition of|
|00000bb0| 20 61 20 63 6f 6e 66 69 | 64 65 6e 63 65 20 69 6e | a confi|dence in|
|00000bc0| 74 65 72 76 61 6c 2c 20 | 6e 61 6d 65 6c 79 20 6f |terval, |namely o|
|00000bd0| 6e 65 20 74 68 61 74 20 | 77 69 6c 6c 20 68 61 76 |ne that |will hav|
|00000be0| 65 20 74 68 65 0d 73 70 | 65 63 69 66 69 65 64 20 |e the.sp|ecified |
|00000bf0| 70 72 6f 62 61 62 69 6c | 69 74 79 20 50 20 6f 66 |probabil|ity P of|
|00000c00| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 74 68 65 20 | contain|ing the |
|00000c10| 75 6e 6b 6e 6f 77 6e 20 | 62 75 74 20 66 69 78 65 |unknown |but fixe|
|00000c20| 64 20 70 61 72 61 6d 65 | 74 65 72 20 70 2e 20 54 |d parame|ter p. T|
|00000c30| 68 61 74 27 73 0d 62 65 | 63 61 75 73 65 2c 20 75 |hat's.be|cause, u|
|00000c40| 6e 6c 69 6b 65 20 74 68 | 65 20 4e 6f 72 6d 61 6c |nlike th|e Normal|
|00000c50| 20 64 69 73 74 72 69 62 | 75 74 69 6f 6e 2c 20 74 | distrib|ution, t|
|00000c60| 68 65 20 42 69 6e 6f 6d | 69 61 6c 20 64 69 73 74 |he Binom|ial dist|
|00000c70| 72 69 62 75 74 69 6f 6e | 20 69 73 20 6e 6f 74 0d |ribution| is not.|
|00000c80| 74 72 61 6e 73 6c 61 74 | 69 6f 6e 20 69 6e 76 61 |translat|ion inva|
|00000c90| 72 69 61 6e 74 2e 20 0d | 0d 49 20 67 61 76 65 20 |riant. .|.I gave |
|00000ca0| 73 6f 6d 65 20 74 68 6f | 75 67 68 74 20 74 6f 20 |some tho|ught to |
|00000cb0| 74 61 6b 69 6e 67 20 61 | 20 42 61 79 65 73 69 61 |taking a| Bayesia|
|00000cc0| 6e 20 61 70 70 72 6f 61 | 63 68 2c 20 61 73 73 75 |n approa|ch, assu|
|00000cd0| 6d 69 6e 67 20 61 20 75 | 6e 69 66 6f 72 6d 20 70 |ming a u|niform p|
|00000ce0| 72 69 6f 72 20 70 64 66 | 0d 66 6f 72 20 70 20 61 |rior pdf|.for p a|
|00000cf0| 6e 64 20 74 68 65 6e 20 | 63 6f 6d 70 75 74 69 6e |nd then |computin|
|00000d00| 67 20 61 6e 20 61 20 70 | 6f 73 74 65 72 69 6f 72 |g an a p|osterior|
|00000d10| 69 20 63 6f 6e 66 69 64 | 65 6e 63 65 20 69 6e 74 |i confid|ence int|
|00000d20| 65 72 76 61 6c 2e 20 54 | 68 69 73 20 63 61 6e 20 |erval. T|his can |
|00000d30| 62 65 20 64 6f 6e 65 2c | 0d 62 75 74 20 69 74 27 |be done,|.but it'|
|00000d40| 73 20 68 61 72 64 2e 20 | 49 20 63 6f 6e 63 6c 75 |s hard. |I conclu|
|00000d50| 64 65 64 20 74 68 61 74 | 20 69 74 27 73 20 70 6f |ded that| it's po|
|00000d60| 69 6e 74 6c 65 73 73 20 | 62 65 63 61 75 73 65 20 |intless |because |
|00000d70| 74 68 65 20 75 6e 69 66 | 6f 72 6d 20 70 72 69 6f |the unif|orm prio|
|00000d80| 72 20 70 64 66 0d 61 73 | 73 75 6d 70 74 69 6f 6e |r pdf.as|sumption|
|00000d90| 20 69 73 20 75 73 75 61 | 6c 6c 79 20 75 6e 77 61 | is usua|lly unwa|
|00000da0| 72 72 61 6e 74 65 64 2e | 0d 0d 45 76 65 6e 20 74 |rranted.|..Even t|
|00000db0| 68 6f 75 67 68 20 74 68 | 69 73 20 63 6f 6e 66 69 |hough th|is confi|
|00000dc0| 64 65 6e 63 65 20 69 6e | 74 65 72 76 61 6c 20 69 |dence in|terval i|
|00000dd0| 73 20 6e 6f 74 20 77 68 | 6f 6c 6c 79 20 73 61 74 |s not wh|olly sat|
|00000de0| 69 73 66 61 63 74 6f 72 | 79 20 28 69 2e 65 2e 20 |isfactor|y (i.e. |
|00000df0| 66 75 6e 64 61 6d 65 6e | 74 61 6c 6c 79 0d 66 61 |fundamen|tally.fa|
|00000e00| 6c 73 65 29 20 69 74 20 | 69 73 20 75 73 65 66 75 |lse) it |is usefu|
|00000e10| 6c 20 69 6e 20 70 72 61 | 63 74 69 63 65 20 73 69 |l in pra|ctice si|
|00000e20| 6e 63 65 20 69 74 20 74 | 79 70 69 63 61 6c 6c 79 |nce it t|ypically|
|00000e30| 20 62 65 68 61 76 65 73 | 20 73 69 6d 69 6c 61 72 | behaves| similar|
|00000e40| 6c 79 20 74 6f 20 74 68 | 65 0d 4e 6f 72 6d 61 6c |ly to th|e.Normal|
|00000e50| 20 63 61 73 65 2c 20 77 | 68 69 63 68 20 69 73 20 | case, w|hich is |
|00000e60| 74 68 65 6f 72 65 74 69 | 63 61 6c 6c 79 20 73 6f |theoreti|cally so|
|00000e70| 75 6e 64 2e 0d 2a 2f 0d | 64 6f 75 62 6c 65 20 42 |und..*/.|double B|
|00000e80| 69 6e 6f 6d 69 61 6c 4c | 6f 77 65 72 42 6f 75 6e |inomialL|owerBoun|
|00000e90| 64 28 64 6f 75 62 6c 65 | 20 50 2c 6c 6f 6e 67 20 |d(double| P,long |
|00000ea0| 6b 2c 6c 6f 6e 67 20 6e | 29 0d 2f 2a 0d 41 72 67 |k,long n|)./*.Arg|
|00000eb0| 75 6d 65 6e 74 73 20 61 | 72 65 20 74 68 65 20 63 |uments a|re the c|
|00000ec0| 6f 6e 66 69 64 65 6e 63 | 65 20 50 2c 20 61 6e 64 |onfidenc|e P, and|
|00000ed0| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6b 20 6f 66 | the num|ber k of|
|00000ee0| 20 68 65 61 64 73 20 69 | 6e 20 6e 20 66 6c 69 70 | heads i|n n flip|
|00000ef0| 73 20 6f 66 20 61 20 63 | 6f 69 6e 2e 0d 54 68 65 |s of a c|oin..The|
|00000f00| 20 72 65 74 75 72 6e 65 | 64 20 76 61 6c 75 65 20 | returne|d value |
|00000f10| 70 20 69 73 20 74 68 65 | 20 6c 6f 77 65 72 20 65 |p is the| lower e|
|00000f20| 6e 64 20 6f 66 20 61 20 | 32 3f 2d 73 69 64 65 64 |nd of a |2?-sided|
|00000f30| 20 50 20 63 6f 6e 66 69 | 64 65 6e 63 65 20 69 6e | P confi|dence in|
|00000f40| 74 65 72 76 61 6c 20 6f | 6e 20 74 68 65 0d 75 6e |terval o|n the.un|
|00000f50| 64 65 72 6c 79 69 6e 67 | 20 70 72 6f 62 61 62 69 |derlying| probabi|
|00000f60| 6c 69 74 79 20 6f 66 20 | 61 20 68 65 61 64 20 6f |lity of |a head o|
|00000f70| 6e 20 61 20 73 69 6e 67 | 6c 65 20 74 72 69 61 6c |n a sing|le trial|
|00000f80| 2e 0d 2a 2f 0d 7b 0d 09 | 64 6f 75 62 6c 65 20 72 |..*/.{..|double r|
|00000f90| 69 67 68 74 2c 73 2c 73 | 73 2c 70 3b 0d 09 0d 09 |ight,s,s|s,p;....|
|00000fa0| 69 66 28 6b 3e 30 20 26 | 26 20 6b 3c 6e 29 7b 0d |if(k>0 &|& k<n){.|
|00000fb0| 09 09 72 69 67 68 74 3d | 6b 2d 30 2e 35 3b 0d 09 |..right=|k-0.5;..|
|00000fc0| 09 73 3d 49 6e 76 65 72 | 73 65 4e 6f 72 6d 61 6c |.s=Inver|seNormal|
|00000fd0| 28 73 71 72 74 28 50 29 | 29 3b 0d 09 09 73 73 3d |(sqrt(P)|);...ss=|
|00000fe0| 73 2a 73 3b 0d 09 09 70 | 3d 28 72 69 67 68 74 2b |s*s;...p|=(right+|
|00000ff0| 30 2e 35 2a 73 73 2d 73 | 2a 73 71 72 74 28 72 69 |0.5*ss-s|*sqrt(ri|
|00001000| 67 68 74 2a 28 31 2e 30 | 2d 72 69 67 68 74 2f 6e |ght*(1.0|-right/n|
|00001010| 29 2b 30 2e 32 35 2a 73 | 73 29 29 2f 28 6e 2b 73 |)+0.25*s|s))/(n+s|
|00001020| 73 29 3b 0d 09 09 72 65 | 74 75 72 6e 20 70 3b 0d |s);...re|turn p;.|
|00001030| 09 7d 0d 09 69 66 28 6b | 3d 3d 30 29 20 72 65 74 |.}..if(k|==0) ret|
|00001040| 75 72 6e 20 30 2e 30 3b | 0d 09 69 66 28 6b 3d 3d |urn 0.0;|..if(k==|
|00001050| 6e 29 20 72 65 74 75 72 | 6e 20 70 6f 77 28 31 2e |n) retur|n pow(1.|
|00001060| 30 2d 50 2c 31 2e 30 2f | 6e 29 3b 0d 09 72 65 74 |0-P,1.0/|n);..ret|
|00001070| 75 72 6e 20 73 71 72 74 | 28 2d 31 2e 30 29 3b 09 |urn sqrt|(-1.0);.|
|00001080| 2f 2a 20 64 6f 6d 61 69 | 6e 20 65 72 72 6f 72 20 |/* domai|n error |
|00001090| 2a 2f 0d 7d 0d 0d 64 6f | 75 62 6c 65 20 42 69 6e |*/.}..do|uble Bin|
|000010a0| 6f 6d 69 61 6c 55 70 70 | 65 72 42 6f 75 6e 64 28 |omialUpp|erBound(|
|000010b0| 64 6f 75 62 6c 65 20 50 | 2c 6c 6f 6e 67 20 6b 2c |double P|,long k,|
|000010c0| 6c 6f 6e 67 20 6e 29 0d | 2f 2a 0d 41 72 67 75 6d |long n).|/*.Argum|
|000010d0| 65 6e 74 73 20 61 72 65 | 20 74 68 65 20 63 6f 6e |ents are| the con|
|000010e0| 66 69 64 65 6e 63 65 20 | 50 2c 20 61 6e 64 20 74 |fidence |P, and t|
|000010f0| 68 65 20 6e 75 6d 62 65 | 72 20 6b 20 6f 66 20 68 |he numbe|r k of h|
|00001100| 65 61 64 73 20 69 6e 20 | 6e 20 66 6c 69 70 73 20 |eads in |n flips |
|00001110| 6f 66 20 61 20 63 6f 69 | 6e 2e 0d 54 68 65 20 72 |of a coi|n..The r|
|00001120| 65 74 75 72 6e 65 64 20 | 76 61 6c 75 65 20 70 20 |eturned |value p |
|00001130| 69 73 20 74 68 65 20 75 | 70 70 65 72 20 65 6e 64 |is the u|pper end|
|00001140| 20 6f 66 20 61 20 32 3f | 2d 73 69 64 65 64 20 50 | of a 2?|-sided P|
|00001150| 20 63 6f 6e 66 69 64 65 | 6e 63 65 20 69 6e 74 65 | confide|nce inte|
|00001160| 72 76 61 6c 20 6f 6e 20 | 74 68 65 0d 75 6e 64 65 |rval on |the.unde|
|00001170| 72 6c 79 69 6e 67 20 70 | 72 6f 62 61 62 69 6c 69 |rlying p|robabili|
|00001180| 74 79 20 6f 66 20 61 20 | 68 65 61 64 20 6f 6e 20 |ty of a |head on |
|00001190| 61 20 73 69 6e 67 6c 65 | 20 74 72 69 61 6c 2e 0d |a single| trial..|
|000011a0| 2a 2f 0d 7b 0d 09 64 6f | 75 62 6c 65 20 72 69 67 |*/.{..do|uble rig|
|000011b0| 68 74 2c 73 2c 73 73 2c | 70 3b 0d 09 0d 09 69 66 |ht,s,ss,|p;....if|
|000011c0| 28 6b 3e 30 20 26 26 20 | 6b 3c 6e 29 7b 0d 09 09 |(k>0 && |k<n){...|
|000011d0| 72 69 67 68 74 3d 6b 2b | 30 2e 35 3b 0d 09 09 73 |right=k+|0.5;...s|
|000011e0| 3d 49 6e 76 65 72 73 65 | 4e 6f 72 6d 61 6c 28 73 |=Inverse|Normal(s|
|000011f0| 71 72 74 28 50 29 29 3b | 0d 09 09 73 73 3d 73 2a |qrt(P));|...ss=s*|
|00001200| 73 3b 0d 09 09 70 3d 28 | 72 69 67 68 74 2b 30 2e |s;...p=(|right+0.|
|00001210| 35 2a 73 73 2b 73 2a 73 | 71 72 74 28 72 69 67 68 |5*ss+s*s|qrt(righ|
|00001220| 74 2a 28 31 2e 30 2d 72 | 69 67 68 74 2f 6e 29 2b |t*(1.0-r|ight/n)+|
|00001230| 30 2e 32 35 2a 73 73 29 | 29 2f 28 6e 2b 73 73 29 |0.25*ss)|)/(n+ss)|
|00001240| 3b 0d 09 09 72 65 74 75 | 72 6e 20 70 3b 0d 09 7d |;...retu|rn p;..}|
|00001250| 0d 09 69 66 28 6b 3d 3d | 30 29 20 72 65 74 75 72 |..if(k==|0) retur|
|00001260| 6e 20 31 2e 30 2d 70 6f | 77 28 31 2e 30 2d 50 2c |n 1.0-po|w(1.0-P,|
|00001270| 31 2e 30 2f 6e 29 3b 0d | 09 69 66 28 6b 3d 3d 6e |1.0/n);.|.if(k==n|
|00001280| 29 20 72 65 74 75 72 6e | 20 31 2e 30 3b 0d 09 72 |) return| 1.0;..r|
|00001290| 65 74 75 72 6e 20 73 71 | 72 74 28 2d 31 2e 30 29 |eturn sq|rt(-1.0)|
|000012a0| 3b 09 2f 2a 20 64 6f 6d | 61 69 6e 20 65 72 72 6f |;./* dom|ain erro|
|000012b0| 72 20 2a 2f 0d 7d 0d 0d | 23 69 66 20 4e 45 57 5f |r */.}..|#if NEW_|
|000012c0| 42 49 4e 4f 4d 49 41 4c | 09 2f 2a 20 6e 65 77 20 |BINOMIAL|./* new |
|000012d0| 72 6f 75 74 69 6e 65 73 | 20 74 68 61 74 20 72 65 |routines| that re|
|000012e0| 71 75 69 72 65 20 4e 75 | 6d 65 72 69 63 61 6c 20 |quire Nu|merical |
|000012f0| 52 65 63 69 70 65 73 20 | 69 6e 20 43 20 2a 2f 0d |Recipes |in C */.|
|00001300| 09 23 69 6e 63 6c 75 64 | 65 20 22 6e 72 2e 68 22 |.#includ|e "nr.h"|
|00001310| 09 09 09 09 2f 2a 20 70 | 72 6f 74 6f 74 79 70 65 |..../* p|rototype|
|00001320| 20 66 6f 72 20 62 65 74 | 61 69 28 29 20 2a 2f 0d | for bet|ai() */.|
|00001330| 09 23 69 66 20 30 0d 09 | 09 76 6f 69 64 20 6d 61 |.#if 0..|.void ma|
|00001340| 69 6e 28 76 6f 69 64 29 | 0d 09 09 2f 2a 20 61 20 |in(void)|.../* a |
|00001350| 71 75 69 63 6b 20 61 6e | 64 20 64 69 72 74 79 20 |quick an|d dirty |
|00001360| 64 72 69 76 65 72 20 74 | 6f 20 74 65 73 74 20 73 |driver t|o test s|
|00001370| 6f 6d 65 20 6f 66 20 74 | 68 65 73 65 20 72 6f 75 |ome of t|hese rou|
|00001380| 74 69 6e 65 73 20 2a 2f | 0d 09 09 7b 0d 09 09 09 |tines */|...{....|
|00001390| 64 6f 75 62 6c 65 20 70 | 2c 70 55 70 70 65 72 2c |double p|,pUpper,|
|000013a0| 70 4c 6f 77 65 72 2c 50 | 2c 50 55 70 70 65 72 2c |pLower,P|,PUpper,|
|000013b0| 50 4c 6f 77 65 72 3b 0d | 09 09 09 69 6e 74 20 69 |PLower;.|...int i|
|000013c0| 2c 6e 2c 6b 3b 0d 09 09 | 09 0d 09 09 09 52 65 71 |,n,k;...|.....Req|
|000013d0| 75 69 72 65 28 30 29 3b | 0d 09 09 09 6e 3d 31 30 |uire(0);|....n=10|
|000013e0| 3b 0d 09 09 09 70 3d 2e | 32 3b 0d 09 09 09 70 4c |;....p=.|2;....pL|
|000013f0| 6f 77 65 72 3d 49 6e 76 | 65 72 73 65 42 69 6e 6f |ower=Inv|erseBino|
|00001400| 6d 69 61 6c 28 30 2e 30 | 35 2c 32 31 2c 35 30 29 |mial(0.0|5,21,50)|
|00001410| 3b 0d 09 09 09 70 72 69 | 6e 74 66 28 22 25 66 2c |;....pri|ntf("%f,|
|00001420| 20 41 62 72 61 6d 6f 77 | 69 74 7a 20 26 20 53 74 | Abramow|itz & St|
|00001430| 65 67 75 6e 20 70 2e 20 | 39 36 30 20 45 78 61 6d |egun p. |960 Exam|
|00001440| 70 6c 65 20 31 38 20 73 | 61 79 20 74 68 69 73 20 |ple 18 s|ay this |
|00001450| 73 68 6f 75 6c 64 20 62 | 65 20 30 2e 33 30 30 33 |should b|e 0.3003|
|00001460| 2e 5c 6e 22 2c 70 4c 6f | 77 65 72 29 3b 0d 09 09 |.\n",pLo|wer);...|
|00001470| 09 50 3d 30 2e 39 35 3b | 0d 09 09 09 66 6f 72 28 |.P=0.95;|....for(|
|00001480| 69 3d 30 3b 69 3c 31 30 | 3b 69 2b 2b 29 7b 0d 09 |i=0;i<10|;i++){..|
|00001490| 09 09 09 6b 3d 42 69 6e | 6f 6d 69 61 6c 53 61 6d |...k=Bin|omialSam|
|000014a0| 70 6c 65 28 20 70 2c 20 | 6e 29 3b 0d 09 09 09 09 |ple( p, |n);.....|
|000014b0| 70 4c 6f 77 65 72 3d 42 | 69 6e 6f 6d 69 61 6c 4c |pLower=B|inomialL|
|000014c0| 6f 77 65 72 42 6f 75 6e | 64 28 50 2c 6b 2c 6e 29 |owerBoun|d(P,k,n)|
|000014d0| 3b 0d 09 09 09 09 70 55 | 70 70 65 72 3d 42 69 6e |;.....pU|pper=Bin|
|000014e0| 6f 6d 69 61 6c 55 70 70 | 65 72 42 6f 75 6e 64 28 |omialUpp|erBound(|
|000014f0| 50 2c 6b 2c 6e 29 3b 0d | 09 09 09 09 50 4c 6f 77 |P,k,n);.|....PLow|
|00001500| 65 72 3d 31 2e 30 2d 42 | 69 6e 6f 6d 69 61 6c 28 |er=1.0-B|inomial(|
|00001510| 70 4c 6f 77 65 72 2c 6b | 2c 6e 29 3b 0d 09 09 09 |pLower,k|,n);....|
|00001520| 09 50 55 70 70 65 72 3d | 42 69 6e 6f 6d 69 61 6c |.PUpper=|Binomial|
|00001530| 28 70 55 70 70 65 72 2c | 6b 2b 31 2c 6e 29 3b 0d |(pUpper,|k+1,n);.|
|00001540| 09 09 09 09 70 72 69 6e | 74 66 28 22 6e 20 25 34 |....prin|tf("n %4|
|00001550| 64 20 70 20 25 36 2e 34 | 66 20 25 36 2e 34 66 b2 |d p %6.4|f %6.4f.|
|00001560| 25 36 2e 34 66 b2 25 36 | 2e 34 66 20 20 25 36 2e |%6.4f.%6|.4f %6.|
|00001570| 34 66 3c 20 3c 25 36 2e | 34 66 5c 6e 22 0d 09 09 |4f< <%6.|4f\n"...|
|00001580| 09 09 09 2c 6e 2c 70 2c | 70 4c 6f 77 65 72 2c 6b |...,n,p,|pLower,k|
|00001590| 2f 28 64 6f 75 62 6c 65 | 29 6e 2c 70 55 70 70 65 |/(double|)n,pUppe|
|000015a0| 72 2c 50 4c 6f 77 65 72 | 2c 50 55 70 70 65 72 29 |r,PLower|,PUpper)|
|000015b0| 3b 0d 09 09 09 09 70 4c | 6f 77 65 72 3d 49 6e 76 |;.....pL|ower=Inv|
|000015c0| 65 72 73 65 42 69 6e 6f | 6d 69 61 6c 28 31 2e 30 |erseBino|mial(1.0|
|000015d0| 2d 73 71 72 74 28 50 29 | 2c 6b 2c 6e 29 3b 0d 09 |-sqrt(P)|,k,n);..|
|000015e0| 09 09 09 70 55 70 70 65 | 72 3d 49 6e 76 65 72 73 |...pUppe|r=Invers|
|000015f0| 65 42 69 6e 6f 6d 69 61 | 6c 28 73 71 72 74 28 50 |eBinomia|l(sqrt(P|
|00001600| 29 2c 6b 2b 31 2c 6e 29 | 3b 0d 09 09 09 09 50 4c |),k+1,n)|;.....PL|
|00001610| 6f 77 65 72 3d 31 2e 30 | 2d 42 69 6e 6f 6d 69 61 |ower=1.0|-Binomia|
|00001620| 6c 28 70 4c 6f 77 65 72 | 2c 6b 2c 6e 29 3b 0d 09 |l(pLower|,k,n);..|
|00001630| 09 09 09 50 55 70 70 65 | 72 3d 42 69 6e 6f 6d 69 |...PUppe|r=Binomi|
|00001640| 61 6c 28 70 55 70 70 65 | 72 2c 6b 2b 31 2c 6e 29 |al(pUppe|r,k+1,n)|
|00001650| 3b 0d 09 09 09 09 70 72 | 69 6e 74 66 28 22 20 20 |;.....pr|intf(" |
|00001660| 25 34 64 20 70 20 25 36 | 2e 34 66 20 25 36 2e 34 |%4d p %6|.4f %6.4|
|00001670| 66 b2 25 36 2e 34 66 b2 | 25 36 2e 34 66 20 20 25 |f.%6.4f.|%6.4f %|
|00001680| 36 2e 34 66 3c 20 3c 25 | 36 2e 34 66 5c 6e 22 0d |6.4f< <%|6.4f\n".|
|00001690| 09 09 09 09 09 2c 6e 2c | 70 2c 70 4c 6f 77 65 72 |.....,n,|p,pLower|
|000016a0| 2c 6b 2f 28 64 6f 75 62 | 6c 65 29 6e 2c 70 55 70 |,k/(doub|le)n,pUp|
|000016b0| 70 65 72 2c 50 4c 6f 77 | 65 72 2c 50 55 70 70 65 |per,PLow|er,PUppe|
|000016c0| 72 29 3b 0d 09 09 09 7d | 0d 09 09 7d 0d 09 23 65 |r);....}|...}..#e|
|000016d0| 6e 64 69 66 0d 09 0d 09 | 64 6f 75 62 6c 65 20 42 |ndif....|double B|
|000016e0| 69 6e 6f 6d 69 61 6c 28 | 64 6f 75 62 6c 65 20 70 |inomial(|double p|
|000016f0| 2c 6c 6f 6e 67 20 6b 2c | 6c 6f 6e 67 20 6e 29 0d |,long k,|long n).|
|00001700| 09 2f 2a 0d 09 52 65 74 | 75 72 6e 73 20 74 68 65 |./*..Ret|urns the|
|00001710| 20 70 72 6f 62 61 62 69 | 6c 69 74 79 20 6f 66 20 | probabi|lity of |
|00001720| 6b 20 6f 72 20 6d 6f 72 | 65 20 68 65 61 64 73 20 |k or mor|e heads |
|00001730| 69 6e 20 6e 20 66 6c 69 | 70 73 2c 20 77 68 65 72 |in n fli|ps, wher|
|00001740| 65 20 70 72 6f 62 61 62 | 69 6c 69 74 79 20 6f 66 |e probab|ility of|
|00001750| 0d 09 65 61 63 68 20 68 | 65 61 64 20 69 73 20 70 |..each h|ead is p|
|00001760| 2e 20 54 68 69 73 20 69 | 64 65 6e 74 69 74 79 20 |. This i|dentity |
|00001770| 61 70 70 65 61 72 73 20 | 69 6e 20 4e 75 6d 65 72 |appears |in Numer|
|00001780| 69 63 61 6c 20 52 65 63 | 69 70 65 73 20 69 6e 20 |ical Rec|ipes in |
|00001790| 43 2c 20 70 61 67 65 20 | 31 38 32 2c 20 61 6e 64 |C, page |182, and|
|000017a0| 0d 09 69 6e 20 41 62 72 | 61 6d 6f 77 69 74 7a 20 |..in Abr|amowitz |
|000017b0| 61 6e 64 20 53 74 65 67 | 75 6e 2c 20 70 2e 20 39 |and Steg|un, p. 9|
|000017c0| 34 35 2e 20 45 71 2e 32 | 36 2e 35 2e 32 34 2e 0d |45. Eq.2|6.5.24..|
|000017d0| 09 2a 2f 0d 09 7b 0d 09 | 09 69 66 28 6b 3e 6e 29 |.*/..{..|.if(k>n)|
|000017e0| 72 65 74 75 72 6e 20 30 | 2e 30 3b 0d 09 09 69 66 |return 0|.0;...if|
|000017f0| 28 6b 3c 3d 30 4c 29 72 | 65 74 75 72 6e 20 31 2e |(k<=0L)r|eturn 1.|
|00001800| 30 3b 0d 09 09 69 66 28 | 70 3d 3d 30 2e 30 29 7b |0;...if(|p==0.0){|
|00001810| 0d 09 09 09 69 66 28 6b | 3d 3d 30 29 72 65 74 75 |....if(k|==0)retu|
|00001820| 72 6e 20 31 2e 30 3b 0d | 09 09 09 65 6c 73 65 20 |rn 1.0;.|...else |
|00001830| 72 65 74 75 72 6e 20 30 | 2e 30 3b 0d 09 09 7d 0d |return 0|.0;...}.|
|00001840| 09 09 69 66 28 70 3d 3d | 31 2e 30 29 72 65 74 75 |..if(p==|1.0)retu|
|00001850| 72 6e 20 31 2e 30 3b 0d | 09 09 72 65 74 75 72 6e |rn 1.0;.|..return|
|00001860| 20 49 6e 63 6f 6d 70 6c | 65 74 65 42 65 74 61 28 | Incompl|eteBeta(|
|00001870| 70 2c 6b 2c 6e 2d 6b 2b | 31 29 3b 0d 09 7d 0d 09 |p,k,n-k+|1);..}..|
|00001880| 0d 09 64 6f 75 62 6c 65 | 20 42 69 6e 6f 6d 69 61 |..double| Binomia|
|00001890| 6c 50 64 66 28 64 6f 75 | 62 6c 65 20 70 2c 6c 6f |lPdf(dou|ble p,lo|
|000018a0| 6e 67 20 6b 2c 6c 6f 6e | 67 20 6e 29 0d 09 2f 2a |ng k,lon|g n)../*|
|000018b0| 0d 09 52 65 74 75 72 6e | 73 20 74 68 65 20 70 72 |..Return|s the pr|
|000018c0| 6f 62 61 62 69 6c 69 74 | 79 20 6f 66 20 65 78 61 |obabilit|y of exa|
|000018d0| 63 74 6c 79 20 6b 20 68 | 65 61 64 73 20 69 6e 20 |ctly k h|eads in |
|000018e0| 6e 20 66 6c 69 70 73 2c | 20 77 68 65 72 65 20 70 |n flips,| where p|
|000018f0| 72 6f 62 61 62 69 6c 69 | 74 79 20 6f 66 0d 09 65 |robabili|ty of..e|
|00001900| 61 63 68 20 68 65 61 64 | 20 69 73 20 70 2e 20 0d |ach head| is p. .|
|00001910| 09 49 27 6d 20 6e 6f 74 | 20 72 65 61 6c 6c 79 20 |.I'm not| really |
|00001920| 73 75 72 65 20 77 68 65 | 74 68 65 72 20 74 68 69 |sure whe|ther thi|
|00001930| 73 20 69 73 20 6d 6f 72 | 65 20 63 6f 6d 70 75 74 |s is mor|e comput|
|00001940| 61 74 69 6f 6e 61 6c 6c | 79 20 65 66 66 69 63 69 |ationall|y effici|
|00001950| 65 6e 74 20 74 68 61 6e | 20 63 6f 6d 70 75 74 69 |ent than| computi|
|00001960| 6e 67 0d 09 69 74 20 64 | 69 72 65 63 74 6c 79 2c |ng..it d|irectly,|
|00001970| 20 66 72 6f 6d 20 74 68 | 65 20 64 65 66 69 6e 69 | from th|e defini|
|00001980| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 62 69 6e 6f |tion of |the bino|
|00001990| 6d 69 61 6c 20 64 69 73 | 74 72 69 62 75 74 69 6f |mial dis|tributio|
|000019a0| 6e 2c 20 62 75 74 20 69 | 74 20 69 73 20 76 65 72 |n, but i|t is ver|
|000019b0| 79 20 65 61 73 79 0d 09 | 74 6f 20 77 72 69 74 65 |y easy..|to write|
|000019c0| 2c 20 61 6e 64 20 61 76 | 6f 69 64 73 20 74 68 65 |, and av|oids the|
|000019d0| 20 64 69 66 66 69 63 75 | 6c 74 79 20 6f 66 20 63 | difficu|lty of c|
|000019e0| 6f 6d 70 75 74 69 6e 67 | 20 74 68 65 20 62 69 6e |omputing| the bin|
|000019f0| 6f 6d 69 61 6c 20 63 6f | 65 66 66 69 63 69 65 6e |omial co|efficien|
|00001a00| 74 0d 09 77 69 74 68 6f | 75 74 20 6f 76 65 72 66 |t..witho|ut overf|
|00001a10| 6c 6f 77 2e 0d 09 2a 2f | 0d 09 7b 0d 09 09 69 66 |low...*/|..{...if|
|00001a20| 28 6b 3c 30 4c 20 7c 7c | 20 6b 3e 6e 29 72 65 74 |(k<0L ||| k>n)ret|
|00001a30| 75 72 6e 20 30 2e 30 3b | 0d 09 09 69 66 28 6b 3d |urn 0.0;|...if(k=|
|00001a40| 3d 6e 29 20 72 65 74 75 | 72 6e 20 70 6f 77 28 70 |=n) retu|rn pow(p|
|00001a50| 2c 6e 29 3b 0d 09 09 72 | 65 74 75 72 6e 20 42 69 |,n);...r|eturn Bi|
|00001a60| 6e 6f 6d 69 61 6c 28 70 | 2c 6b 2c 6e 29 2d 42 69 |nomial(p|,k,n)-Bi|
|00001a70| 6e 6f 6d 69 61 6c 28 70 | 2c 6b 2b 31 2c 6e 29 3b |nomial(p|,k+1,n);|
|00001a80| 0d 09 7d 0d 09 0d 09 64 | 6f 75 62 6c 65 20 49 6e |..}....d|ouble In|
|00001a90| 76 65 72 73 65 42 69 6e | 6f 6d 69 61 6c 28 64 6f |verseBin|omial(do|
|00001aa0| 75 62 6c 65 20 50 2c 6c | 6f 6e 67 20 6b 2c 6c 6f |uble P,l|ong k,lo|
|00001ab0| 6e 67 20 6e 29 0d 09 2f | 2a 20 52 65 74 75 72 6e |ng n)../|* Return|
|00001ac0| 73 20 74 68 65 20 50 2d | 74 68 20 71 75 61 6e 74 |s the P-|th quant|
|00001ad0| 69 6c 65 20 66 6f 72 20 | 74 68 65 20 70 72 6f 62 |ile for |the prob|
|00001ae0| 61 62 69 6c 69 74 79 20 | 70 20 6f 66 20 61 20 68 |ability |p of a h|
|00001af0| 65 61 64 73 2c 0d 09 67 | 69 76 65 6e 20 6b 20 68 |eads,..g|iven k h|
|00001b00| 65 61 64 73 20 69 6e 20 | 6e 20 66 6c 69 70 73 2e |eads in |n flips.|
|00001b10| 20 0d 09 70 55 70 70 65 | 72 3d 49 6e 76 65 72 73 | ..pUppe|r=Invers|
|00001b20| 65 42 69 6e 6f 6d 69 61 | 6c 28 30 2e 39 37 35 2c |eBinomia|l(0.975,|
|00001b30| 6b 2b 31 2c 6e 29 20 69 | 73 20 61 20 39 37 2e 35 |k+1,n) i|s a 97.5|
|00001b40| 25 20 63 6f 6e 66 69 64 | 65 6e 63 65 20 75 70 70 |% confid|ence upp|
|00001b50| 65 72 20 62 6f 75 6e 64 | 20 6f 6e 20 70 0d 09 70 |er bound| on p..p|
|00001b60| 4c 6f 77 65 72 3d 49 6e | 76 65 72 73 65 42 69 6e |Lower=In|verseBin|
|00001b70| 6f 6d 69 61 6c 28 30 2e | 30 32 35 2c 6b 2c 6e 29 |omial(0.|025,k,n)|
|00001b80| 20 69 73 20 61 20 39 37 | 2e 35 25 20 63 6f 6e 66 | is a 97|.5% conf|
|00001b90| 69 64 65 6e 63 65 20 6c | 6f 77 65 72 20 62 6f 75 |idence l|ower bou|
|00001ba0| 6e 64 20 6f 6e 20 70 0d | 09 54 61 6b 65 6e 20 74 |nd on p.|.Taken t|
|00001bb0| 6f 67 65 74 68 65 72 20 | 74 68 65 73 65 20 62 6f |ogether |these bo|
|00001bc0| 75 6e 64 73 20 66 6f 72 | 6d 20 61 20 39 37 2e 35 |unds for|m a 97.5|
|00001bd0| 25 2a 39 37 2e 35 25 3d | 39 35 25 20 63 6f 6e 66 |%*97.5%=|95% conf|
|00001be0| 69 64 65 6e 63 65 20 69 | 6e 74 65 72 76 61 6c 3a |idence i|nterval:|
|00001bf0| 20 5b 70 4c 6f 77 65 72 | 2c 70 55 70 70 65 72 5d | [pLower|,pUpper]|
|00001c00| 2e 0d 09 2a 2f 0d 09 7b | 0d 09 23 69 66 20 30 0d |...*/..{|..#if 0.|
|00001c10| 09 09 72 65 74 75 72 6e | 20 49 6e 76 65 72 73 65 |..return| Inverse|
|00001c20| 49 6e 63 6f 6d 70 6c 65 | 74 65 42 65 74 61 28 50 |Incomple|teBeta(P|
|00001c30| 2c 6b 2c 6e 2d 6b 2b 31 | 29 3b 0d 09 23 65 6c 73 |,k,n-k+1|);..#els|
|00001c40| 65 0d 09 09 2f 2a 0d 09 | 09 54 68 69 73 20 73 69 |e.../*..|.This si|
|00001c50| 6d 70 6c 65 2d 6d 69 6e | 64 65 64 20 62 69 73 65 |mple-min|ded bise|
|00001c60| 63 74 69 6f 6e 20 72 6f | 75 74 69 6e 65 20 69 73 |ction ro|utine is|
|00001c70| 20 73 6c 6f 77 2c 20 62 | 75 74 20 69 74 73 20 61 | slow, b|ut its a|
|00001c80| 6e 73 77 65 72 20 69 73 | 20 61 63 63 75 72 61 74 |nswer is| accurat|
|00001c90| 65 0d 09 09 74 6f 20 77 | 69 74 68 69 6e 20 b1 31 |e...to w|ithin .1|
|00001ca0| 65 2d 31 30 2e 20 0d 09 | 09 2a 2f 0d 09 09 64 6f |e-10. ..|.*/...do|
|00001cb0| 75 62 6c 65 20 6c 6f 77 | 3d 30 2e 30 2c 68 69 67 |uble low|=0.0,hig|
|00001cc0| 68 3d 31 2e 30 2c 6d 69 | 64 3b 0d 09 09 64 6f 75 |h=1.0,mi|d;...dou|
|00001cd0| 62 6c 65 20 66 3b 0d 09 | 09 69 6e 74 20 69 3b 0d |ble f;..|.int i;.|
|00001ce0| 09 09 0d 09 09 66 6f 72 | 28 69 3d 30 3b 69 3c 33 |.....for|(i=0;i<3|
|00001cf0| 30 3b 69 2b 2b 29 7b 0d | 09 09 09 6d 69 64 3d 28 |0;i++){.|...mid=(|
|00001d00| 6c 6f 77 2b 68 69 67 68 | 29 2f 32 2e 30 3b 0d 09 |low+high|)/2.0;..|
|00001d10| 09 09 66 3d 42 69 6e 6f | 6d 69 61 6c 28 6d 69 64 |..f=Bino|mial(mid|
|00001d20| 2c 6b 2c 6e 29 3b 0d 09 | 09 09 69 66 28 66 3e 50 |,k,n);..|..if(f>P|
|00001d30| 29 68 69 67 68 3d 6d 69 | 64 3b 0d 09 09 09 65 6c |)high=mi|d;....el|
|00001d40| 73 65 20 6c 6f 77 3d 6d | 69 64 3b 0d 09 09 7d 0d |se low=m|id;...}.|
|00001d50| 09 09 72 65 74 75 72 6e | 20 28 6c 6f 77 2b 68 69 |..return| (low+hi|
|00001d60| 67 68 29 2f 32 2e 30 3b | 0d 09 23 65 6e 64 69 66 |gh)/2.0;|..#endif|
|00001d70| 0d 09 7d 0d 0d 09 64 6f | 75 62 6c 65 20 49 6e 63 |..}...do|uble Inc|
|00001d80| 6f 6d 70 6c 65 74 65 42 | 65 74 61 28 64 6f 75 62 |ompleteB|eta(doub|
|00001d90| 6c 65 20 78 2c 64 6f 75 | 62 6c 65 20 61 2c 64 6f |le x,dou|ble a,do|
|00001da0| 75 62 6c 65 20 62 29 0d | 09 2f 2a 0d 09 54 68 65 |uble b).|./*..The|
|00001db0| 20 69 6e 63 6f 6d 70 6c | 65 74 65 20 62 65 74 61 | incompl|ete beta|
|00001dc0| 20 66 75 6e 63 74 69 6f | 6e 20 49 78 28 61 2c 62 | functio|n Ix(a,b|
|00001dd0| 29 2e 0d 09 54 68 65 20 | 4e 75 6d 65 72 69 63 61 |)...The |Numerica|
|00001de0| 6c 20 52 65 63 69 70 65 | 73 20 72 6f 75 74 69 6e |l Recipe|s routin|
|00001df0| 65 20 61 73 73 75 6d 65 | 73 20 61 3e 30 2e 20 54 |e assume|s a>0. T|
|00001e00| 68 69 73 20 77 6f 72 6b | 2d 61 72 6f 75 6e 64 20 |his work|-around |
|00001e10| 69 73 20 74 61 6b 65 6e | 20 66 72 6f 6d 0d 09 41 |is taken| from..A|
|00001e20| 62 72 61 6d 6f 77 69 74 | 7a 20 61 6e 64 20 53 74 |bramowit|z and St|
|00001e30| 65 67 75 6e 20 70 61 67 | 65 20 39 34 34 2c 20 45 |egun pag|e 944, E|
|00001e40| 71 2e 20 32 36 2e 35 2e | 31 36 2e 0d 09 2a 2f 0d |q. 26.5.|16...*/.|
|00001e50| 09 7b 0d 09 09 69 66 28 | 61 3e 30 2e 30 29 72 65 |.{...if(|a>0.0)re|
|00001e60| 74 75 72 6e 20 62 65 74 | 61 69 28 61 2c 62 2c 78 |turn bet|ai(a,b,x|
|00001e70| 29 3b 09 2f 2a 20 4e 75 | 6d 65 72 69 63 61 6c 20 |);./* Nu|merical |
|00001e80| 52 65 63 69 70 65 73 20 | 69 6e 20 43 20 2a 2f 0d |Recipes |in C */.|
|00001e90| 09 09 65 6c 73 65 20 72 | 65 74 75 72 6e 20 49 6e |..else r|eturn In|
|00001ea0| 63 6f 6d 70 6c 65 74 65 | 42 65 74 61 28 78 2c 61 |complete|Beta(x,a|
|00001eb0| 2b 31 2e 30 2c 62 29 0d | 09 09 09 2b 65 78 70 28 |+1.0,b).|...+exp(|
|00001ec0| 67 61 6d 6d 6c 6e 28 61 | 2b 62 29 2d 67 61 6d 6d |gammln(a|+b)-gamm|
|00001ed0| 6c 6e 28 61 2b 31 2e 30 | 29 2d 67 61 6d 6d 6c 6e |ln(a+1.0|)-gammln|
|00001ee0| 28 62 29 2b 61 2a 6c 6f | 67 28 78 29 2b 62 2a 6c |(b)+a*lo|g(x)+b*l|
|00001ef0| 6f 67 28 31 2e 30 2d 78 | 29 29 3b 0d 09 7d 0d 09 |og(1.0-x|));..}..|
|00001f00| 0d 09 64 6f 75 62 6c 65 | 20 49 6e 76 65 72 73 65 |..double| Inverse|
|00001f10| 49 6e 63 6f 6d 70 6c 65 | 74 65 42 65 74 61 28 64 |Incomple|teBeta(d|
|00001f20| 6f 75 62 6c 65 20 70 2c | 64 6f 75 62 6c 65 20 61 |ouble p,|double a|
|00001f30| 2c 64 6f 75 62 6c 65 20 | 62 29 0d 09 2f 2a 0d 09 |,double |b)../*..|
|00001f40| 54 68 69 73 20 73 69 6d | 70 6c 65 2d 6d 69 6e 64 |This sim|ple-mind|
|00001f50| 65 64 20 62 69 73 65 63 | 74 69 6f 6e 20 72 6f 75 |ed bisec|tion rou|
|00001f60| 74 69 6e 65 20 69 73 20 | 73 6c 6f 77 2c 20 62 75 |tine is |slow, bu|
|00001f70| 74 20 69 74 73 20 61 6e | 73 77 65 72 20 69 73 20 |t its an|swer is |
|00001f80| 61 63 63 75 72 61 74 65 | 0d 09 74 6f 20 77 69 74 |accurate|..to wit|
|00001f90| 68 69 6e 20 b1 31 65 2d | 31 30 2e 20 0d 09 2a 2f |hin .1e-|10. ..*/|
|00001fa0| 0d 09 7b 0d 09 09 64 6f | 75 62 6c 65 20 66 2c 6c |..{...do|uble f,l|
|00001fb0| 6f 77 3d 30 2e 30 2c 68 | 69 67 68 3d 31 2e 30 2c |ow=0.0,h|igh=1.0,|
|00001fc0| 6d 69 64 3b 0d 09 09 69 | 6e 74 20 69 3b 0d 09 09 |mid;...i|nt i;...|
|00001fd0| 0d 09 09 66 6f 72 28 69 | 3d 30 3b 69 3c 33 30 3b |...for(i|=0;i<30;|
|00001fe0| 69 2b 2b 29 7b 0d 09 09 | 09 6d 69 64 3d 28 6c 6f |i++){...|.mid=(lo|
|00001ff0| 77 2b 68 69 67 68 29 2a | 30 2e 35 3b 0d 09 09 09 |w+high)*|0.5;....|
|00002000| 66 3d 49 6e 63 6f 6d 70 | 6c 65 74 65 42 65 74 61 |f=Incomp|leteBeta|
|00002010| 28 6d 69 64 2c 61 2c 62 | 29 3b 0d 09 09 09 69 66 |(mid,a,b|);....if|
|00002020| 28 66 3e 70 29 68 69 67 | 68 3d 6d 69 64 3b 0d 09 |(f>p)hig|h=mid;..|
|00002030| 09 09 65 6c 73 65 20 6c | 6f 77 3d 6d 69 64 3b 0d |..else l|ow=mid;.|
|00002040| 09 09 7d 0d 09 09 72 65 | 74 75 72 6e 20 28 6c 6f |..}...re|turn (lo|
|00002050| 77 2b 68 69 67 68 29 2a | 30 2e 35 3b 0d 09 7d 0d |w+high)*|0.5;..}.|
|00002060| 09 0d 23 65 6e 64 69 66 | 0d 00 00 00 00 00 00 00 |..#endif|........|
|00002070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002080| 00 00 01 00 00 00 02 6c | 00 00 01 6c 00 00 00 5e |.......l|...l...^|
|00002090| 70 79 72 69 67 68 74 20 | 28 63 29 20 31 39 39 30 |pyright |(c) 1990|
|000020a0| 20 44 65 6e 69 73 20 47 | 2e 20 50 65 6c 6c 69 0d | Denis G|. Pelli.|
|000020b0| 0a 42 69 6e 6f 6d 69 61 | 6c 2e 63 6d 02 00 00 00 |.Binomia|l.cm....|
|000020c0| 54 45 58 54 43 57 49 45 | 01 00 00 28 00 60 00 00 |TEXTCWIE|...(.`..|
|000020d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 28 00 60 |..TEXTCW|IE...(.`|
|000020e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000020f0| 00 00 a2 45 52 db 00 00 | 1f e9 00 00 02 ca 0d 74 |...ER...|.......t|
|00002100| 68 65 20 75 6e 64 65 72 | 6c 79 69 6e 67 20 62 69 |he under|lying bi|
|00002110| 6e 6f 6d 69 61 6c 20 70 | 72 6f 62 61 62 69 6c 69 |nomial p|robabili|
|00002120| 74 79 20 61 73 73 75 6d | 65 64 20 74 6f 20 68 61 |ty assum|ed to ha|
|00002130| 76 65 20 67 65 6e 65 72 | 61 74 65 64 20 74 68 65 |ve gener|ated the|
|00002140| 20 64 61 74 61 2e 0d 54 | 72 61 6e 73 6c 61 74 65 | data..T|ranslate|
|00002150| 64 20 66 72 6f 6d 20 74 | 68 65 20 46 4f 52 54 52 |d from t|he FORTR|
|00002160| 41 4e 20 73 74 61 74 65 | 6d 65 6e 74 20 66 75 6e |AN state|ment fun|
|00002170| 63 74 69 6f 6e 73 20 69 | 6e 20 51 55 49 43 4b 32 |ctions i|n QUICK2|
|00002180| 00 00 00 1e 00 50 00 20 | 01 dd 02 3d 00 50 00 20 |.....P. |...=.P. |
|00002190| 01 dd 02 3d 00 00 0e c9 | 00 00 00 00 00 00 00 00 |...=....|........|
|000021a0| 00 00 00 00 00 f2 00 0a | 00 00 16 6e 00 00 16 76 |........|...n...v|
|000021b0| 09 42 69 6e 6f 6d 69 61 | 6c 00 00 00 0e 0e 00 00 |.Binomia|l.......|
|000021c0| 0e 20 13 42 69 6e 6f 6d | 69 61 6c 4c 6f 77 65 72 |. .Binom|ialLower|
|000021d0| 42 6f 75 6e 64 00 00 00 | 18 18 00 00 18 23 0b 42 |Bound...|.....#.B|
|000021e0| 69 6e 6f 6d 69 61 6c 50 | 64 66 00 00 04 cb 00 00 |inomialP|df......|
|000021f0| 04 d9 0f 42 69 6e 6f 6d | 69 61 6c 53 61 6d 70 6c |...Binom|ialSampl|
|00002200| 65 00 00 00 06 87 00 00 | 06 9c 15 42 69 6e 6f 6d |e.......|...Binom|
|00002210| 69 61 6c 53 61 6d 70 6c | 65 51 75 69 63 6b 6c 79 |ialSampl|eQuickly|
|00002220| 00 00 10 2c 00 00 10 3e | 13 42 69 6e 6f 6d 69 61 |...,...>|.Binomia|
|00002230| 6c 55 70 70 65 72 42 6f | 75 6e 64 00 00 00 1d 0c |lUpperBo|und.....|
|00002240| 00 00 1d 1a 0f 49 6e 63 | 6f 6d 70 6c 65 74 65 42 |.....Inc|ompleteB|
|00002250| 65 74 61 00 00 00 1a 1d | 00 00 1a 2c 0f 49 6e 76 |eta.....|...,.Inv|
|00002260| 65 72 73 65 42 69 6e 6f | 6d 69 61 6c 00 00 1e 98 |erseBino|mial....|
|00002270| 00 00 1e ad 15 49 6e 76 | 65 72 73 65 49 6e 63 6f |.....Inv|erseInco|
|00002280| 6d 70 6c 65 74 65 42 65 | 74 61 00 00 12 cd 00 00 |mpleteBe|ta......|
|00002290| 12 d1 05 6d 61 69 6e 00 | 00 00 00 48 00 09 4d 6f |...main.|...H..Mo|
|000022a0| 6e 61 63 6f 00 00 00 00 | 00 00 00 00 00 00 00 00 |naco....|........|
|000022b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 03 |........|........|
|000022c0| 00 04 00 3e 00 03 01 a0 | 02 7d 00 3e 00 03 01 a0 |...>....|.}.>....|
|000022d0| 02 7d ae 20 30 5c 00 00 | 04 8b 00 00 04 99 00 00 |.}. 0\..|........|
|000022e0| 00 00 00 00 00 00 00 04 | 00 01 00 01 00 00 01 00 |........|........|
|000022f0| 00 00 02 6c 00 00 01 6c | 00 00 00 5e 01 d2 12 48 |...l...l|...^...H|
|00002300| 37 d2 00 00 00 1c 00 5e | 00 01 4d 50 53 52 00 02 |7......^|..MPSR..|
|00002310| 00 12 4d 57 42 42 00 00 | 00 36 03 f0 ff ff 00 00 |..MWBB..|.6......|
|00002320| 00 00 00 00 00 00 03 ef | ff ff 00 00 00 22 00 00 |........|....."..|
|00002330| 00 00 03 ed ff ff 00 00 | 01 18 00 00 00 00 03 f0 |........|........|
|00002340| ff ff 00 00 01 64 00 00 | 00 00 00 00 00 00 00 00 |.....d..|........|
|00002350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+