二項分布の部分和

last updated: 2016-12-28

はじめに

二項分布の部分和を計算しています。show-flonumを使って小数点五桁までの計算結果を表示しています。

\[ P\left\{x\geq x_{0} \right\} = \sum_{x=x_{0}}^n \frac{n!} {x!(n-x)!} p^x q^{n-x} , q = 1 - p \]

ソースはつぎのとおりです。

(define (partial-sums-of-the-binomial-distribution n x0 p)
  (fold + 0 (map (lambda (x)
		   (* (/ (fact n)
			 (* (fact x) (fact (- n x))))
		      (expt p x)
		      (expt (- 1 p) (- n x))))
		 (iota (+ 1 (- n x0)) x0))))

計算結果

n = 2

nx0p
0.050.10.150.20.250.30.350.40.450.5
210.097500.190000.277500.360000.437500.510000.577500.640000.697500.75000
20.002500.010000.022500.040000.062500.090000.122500.160000.202500.25000

n = 3

nx0p
0.050.10.150.20.250.30.350.40.450.5
310.142620.271000.385880.488000.578120.657000.725380.784000.833620.87500
20.007250.028000.060750.104000.156250.216000.281750.352000.425250.50000
30.000120.001000.003380.008000.015620.027000.042880.064000.091120.12500

n = 4

nx0p
0.050.10.150.20.250.30.350.40.450.5
410.185490.343900.477990.590400.683590.759900.821490.870400.908490.93750
20.014020.052300.109520.180800.261720.348300.437020.524800.609020.68750
30.000480.003700.011980.027200.050780.083700.126480.179200.241480.31250
40.000010.000100.000510.001600.003910.008100.015010.025600.041010.06250

n = 5

nx0p
0.050.10.150.20.250.30.350.40.450.5
510.226220.409510.556290.672320.762700.831930.883970.922240.949670.96875
20.022590.081460.164790.262720.367190.471780.571580.663040.743780.81250
30.001160.008560.026610.057920.103520.163080.235170.317440.406870.50000
40.000030.000460.002230.006720.015620.030780.054020.087040.131220.18750
50.000000.000010.000080.000320.000980.002430.005250.010240.018450.03125

n = 6

nx0p
0.050.10.150.20.250.30.350.40.450.5
610.264910.468560.622850.737860.822020.882350.924580.953340.972320.98438
20.032770.114260.223520.344640.466060.579820.680920.766720.836430.89062
30.002230.015850.047340.098880.169430.255690.352910.455680.558480.65625
40.000090.001270.005890.016960.037600.070470.117420.179200.255260.34375
50.000000.000060.000400.001600.004640.010940.022320.040960.069200.10938
60.000000.000000.000010.000060.000240.000730.001840.004100.008300.01562

n = 7

nx0p
0.050.10.150.20.250.30.350.40.450.5
710.301660.521700.679420.790280.866520.917650.950980.972010.984780.99219
20.044380.149690.283420.423280.555050.670580.766200.841370.897580.93750
30.003760.025690.073770.148030.243590.352930.467720.580100.683560.77344
40.000190.002730.012100.033340.070560.126040.199850.289790.391710.50000
50.000010.000180.001220.004670.012880.028800.055610.096260.152930.22656
60.000000.000010.000070.000370.001340.003790.009010.018840.035710.06250
70.000000.000000.000000.000010.000060.000220.000640.001640.003740.00781

n = 8

nx0p
0.050.10.150.20.250.30.350.40.450.5
810.336580.569530.727510.832230.899890.942350.968140.983200.991630.99609
20.057240.186900.342820.496680.632920.744700.830870.893620.936820.96484
30.005790.038090.105210.203080.321460.448230.572190.684610.779870.85547
40.000370.005020.021350.056280.113820.194100.293600.405910.523040.63672
50.000020.000430.002850.010410.027300.057970.106090.173670.260380.36328
60.000000.000020.000240.001230.004230.011290.025320.049810.088460.14453
70.000000.000000.000010.000080.000380.001290.003570.008520.018120.03516
80.000000.000000.000000.000000.000020.000070.000230.000660.001680.00391

n = 9

nx0p
0.050.10.150.20.250.30.350.40.450.5
910.369750.612580.768380.865780.924920.959650.979290.989920.995390.99805
20.071210.225160.400520.563790.699660.804000.878910.929460.961480.98047
30.008360.052970.140850.261800.399320.537170.662730.768210.850500.91016
40.000640.008330.033930.085640.165730.270340.391110.517390.638620.74609
50.000030.000890.005630.019580.048930.098810.171720.266570.378580.50000
60.000000.000060.000630.003070.009990.025290.053590.099350.165820.25391
70.000000.000000.000050.000310.001340.004290.011180.025030.049770.08984
80.000000.000000.000000.000020.000110.000430.001400.003800.009080.01953
90.000000.000000.000000.000000.000000.000020.000080.000260.000760.00195

n = 10

nx0p
0.050.10.150.20.250.30.350.40.450.5
1010.401260.651320.803130.892630.943690.971750.986540.993950.997470.99902
20.086140.263900.455700.624190.755970.850690.914050.953640.976740.98926
30.011500.070190.179800.322200.474410.617220.738390.832710.900440.94531
40.001030.012800.049970.120870.224120.350390.486170.617720.733960.82812
50.000060.001630.009870.032790.078130.150270.248500.366900.495600.62305
60.000000.000150.001380.006370.019730.047350.094930.166240.261560.37695
70.000000.000010.000130.000860.003510.010590.026020.054760.101990.17188
80.000000.000000.000010.000080.000420.001590.004820.012290.027390.05469
90.000000.000000.000000.000000.000030.000140.000540.001680.004500.01074
100.000000.000000.000000.000000.000000.000010.000030.000100.000340.00098

n = 11

nx0p
0.050.10.150.20.250.30.350.40.450.5
1110.431200.686190.832660.914100.957760.980230.991250.996370.998610.99951
20.101890.302640.507810.677880.802900.887010.939420.969770.986070.99414
30.015240.089560.221190.382600.544800.687260.799870.881080.934780.96729
40.001550.018530.069440.161140.286700.430440.574450.703720.808880.88672
50.000110.002750.015890.050410.114630.210300.331690.467230.602860.72559
60.000010.000300.002660.011650.034330.078220.148680.246500.366880.50000
70.000000.000020.000320.001970.007560.021620.050140.099350.173800.27441
80.000000.000000.000030.000240.001190.004290.012240.029280.060960.11328
90.000000.000000.000000.000020.000130.000580.002040.005920.014800.03271
100.000000.000000.000000.000000.000010.000050.000210.000730.002210.00586
110.000000.000000.000000.000000.000000.000000.000010.000040.000150.00049

n = 12

nx0p
0.050.10.150.20.250.30.350.40.450.5
1210.459640.717570.857760.931280.968320.986160.994310.997820.999230.99976
20.118360.341000.556540.725120.841620.914970.957560.980410.991710.99683
30.019570.110870.264180.441650.609320.747180.848710.916560.957860.98071
40.002240.025640.092210.205430.351220.507480.653350.774660.865530.92700
50.000180.004330.023920.072560.157640.276340.416650.561820.695570.80615
60.000010.000540.004640.019410.054400.117850.212740.334790.473070.61279
70.000000.000050.000670.003900.014250.038600.084630.158210.260690.38721
80.000000.000000.000070.000580.002780.009490.025510.057310.111740.19385
90.000000.000000.000010.000060.000390.001690.005610.015270.035570.07300
100.000000.000000.000000.000000.000040.000210.000850.002810.007880.01929
110.000000.000000.000000.000000.000000.000020.000080.000320.001080.00317
120.000000.000000.000000.000000.000000.000000.000000.000020.000070.00024

n = 13

nx0p
0.050.10.150.20.250.30.350.40.450.5
1310.486660.745810.879090.945020.976240.990310.996300.998690.999580.99988
20.135420.378660.601720.766350.873290.936330.970420.987370.995100.99829
30.024510.133880.308040.498350.667400.797520.886810.942100.973090.98877
40.003100.034160.118000.252680.415750.579390.721730.831420.907080.95386
50.000290.006460.034160.099130.206040.345690.499500.646960.772050.86658
60.000020.000920.007530.030040.080210.165400.284110.425600.573190.70947
70.000000.000100.001270.007000.024290.062380.129470.228840.356260.50000
80.000000.000010.000160.001250.005650.018220.046200.097670.178770.29053
90.000000.000000.000020.000170.000990.004030.012570.032080.069850.13342
100.000000.000000.000000.000020.000130.000650.002510.007790.020340.04614
110.000000.000000.000000.000000.000010.000070.000350.001320.004140.01123
120.000000.000000.000000.000000.000000.000000.000030.000140.000520.00171
130.000000.000000.000000.000000.000000.000000.000000.000010.000030.00012

n = 14

nx0p
0.050.10.150.20.250.30.350.40.450.5
1410.512330.771230.897230.956020.982180.993220.997600.999220.999770.99994
20.152990.415370.643330.802090.899030.952520.979480.991900.997110.99908
30.030050.158360.352090.551950.718870.839160.916070.960210.982990.99353
40.004170.044130.146510.301810.478660.644830.779500.875690.936780.97131
50.000430.009230.046740.129840.258470.415800.577280.720740.832810.91022
60.000030.001470.011530.043850.111670.219480.359490.514150.662680.78802
70.000000.000180.002210.011610.038270.093280.183590.307550.453880.60474
80.000000.000020.000330.002400.010310.031470.075340.150140.258640.39526
90.000000.000000.000040.000380.002150.008290.024340.058320.118860.21198
100.000000.000000.000000.000050.000340.001670.006040.017510.042620.08978
110.000000.000000.000000.000000.000040.000250.001110.003910.011430.02869
120.000000.000000.000000.000000.000000.000030.000140.000610.002150.00647
130.000000.000000.000000.000000.000000.000000.000010.000060.000250.00092
140.000000.000000.000000.000000.000000.000000.000000.000000.000010.00006

n = 15

nx0p
0.050.10.150.20.250.30.350.40.450.5
1510.536710.794110.912650.964820.986640.995250.998440.999530.999870.99997
20.170950.450960.681410.832870.919820.964730.985820.994830.998310.99951
30.036200.184060.395770.601980.763910.873170.938270.972890.989350.99631
40.005470.055560.177340.351840.538710.703130.827300.909500.957580.98242
50.000610.012720.061710.164230.313510.484510.648060.782720.879600.94077
60.000050.002250.016810.061050.148370.278380.435720.596780.739240.84912
70.000000.000310.003610.018060.056620.131140.245160.390190.547840.69638
80.000000.000030.000610.004240.017300.050010.113230.213100.346500.50000
90.000000.000000.000080.000780.004190.015240.042190.095050.181760.30362
100.000000.000000.000010.000110.000790.003650.012440.033830.076930.15088
110.000000.000000.000000.000010.000120.000670.002830.009350.025470.05923
120.000000.000000.000000.000000.000010.000090.000480.001930.006330.01758
130.000000.000000.000000.000000.000000.000010.000060.000280.001110.00369
140.000000.000000.000000.000000.000000.000000.000000.000030.000120.00049
150.000000.000000.000000.000000.000000.000000.000000.000000.000010.00003

n = 16

nx0p
0.050.10.150.20.250.30.350.40.450.5
1610.559870.814700.925750.971850.989980.996680.998980.999720.999930.99998
20.189240.485270.716100.859260.936520.973890.990240.996710.999010.99974
30.042940.210750.438620.648160.802890.900640.954910.981660.993380.99791
40.007000.068410.210110.401870.595010.754140.866140.934850.971870.98936
50.000860.017000.079050.201750.369810.550100.710790.833430.914690.96159
60.000080.003300.023540.081690.189650.340220.510040.671160.802400.89494
70.000010.000500.005590.026660.079560.175310.311850.472830.633970.77275
80.000000.000060.001060.007000.027130.074350.159410.283940.437100.59819
90.000000.000010.000160.001480.007470.025670.067060.142270.255890.40181
100.000000.000000.000020.000250.001640.007130.022860.058320.124100.22725
110.000000.000000.000000.000030.000290.001570.006200.019140.048620.10506
120.000000.000000.000000.000000.000040.000270.001300.004900.014940.03841
130.000000.000000.000000.000000.000000.000030.000200.000940.003460.01064
140.000000.000000.000000.000000.000000.000000.000020.000130.000560.00209
150.000000.000000.000000.000000.000000.000000.000000.000010.000060.00026
160.000000.000000.000000.000000.000000.000000.000000.000000.000000.00002

n = 17

nx0p
0.050.10.150.20.250.30.350.40.450.5
1710.581880.833230.936890.977480.992480.997670.999340.999830.999960.99999
20.207770.518210.747550.881780.949890.980720.993300.997910.999430.99986
30.050250.238200.480240.690380.836300.922610.967270.987680.995910.99883
40.008800.082640.244390.451120.646980.798090.897210.953580.981550.99364
50.001160.022140.098710.241780.426110.611310.765160.874000.940420.97548
60.000120.004670.031870.105700.234690.403180.580300.736070.852930.92827
70.000010.000780.008280.037660.107080.224780.381220.552160.709760.83385
80.000000.000110.001740.010930.040240.104640.212760.359490.525690.68547
90.000000.000010.000300.002580.012380.040280.099380.198940.337440.50000
100.000000.000000.000040.000490.003100.012690.038330.091900.183410.31453
110.000000.000000.000000.000080.000630.003240.012030.034810.082590.16615
120.000000.000000.000000.000010.000100.000660.003010.010590.030100.07173
130.000000.000000.000000.000000.000010.000100.000590.002520.008620.02452
140.000000.000000.000000.000000.000000.000010.000090.000450.001870.00636
150.000000.000000.000000.000000.000000.000000.000010.000060.000290.00117
160.000000.000000.000000.000000.000000.000000.000000.000000.000030.00014
170.000000.000000.000000.000000.000000.000000.000000.000000.000000.00001

n = 18

nx0p
0.050.10.150.20.250.30.350.40.450.5
1810.602790.849910.946350.981990.994360.998370.999570.999900.999981.00000
20.226480.549720.775950.900920.960540.985810.995410.998680.999670.99993
30.058130.266200.520340.728660.864690.940050.976380.991770.997490.99934
40.010870.098200.279760.498970.694310.835450.921730.967220.988020.99623
50.001550.028190.120560.283650.481330.667350.811380.905830.958930.98456
60.000170.006420.041900.132920.282550.465620.645000.791240.892300.95187
70.000020.001170.011820.051270.138980.278300.450900.625720.774190.88106
80.000000.000170.002720.016280.056950.140680.271720.436560.608520.75966
90.000000.000020.000510.004250.019350.059590.139060.263160.422150.59274
100.000000.000000.000080.000910.005420.020970.059690.134710.252720.40726
110.000000.000000.000010.000160.001240.006070.021230.057650.127960.24034
120.000000.000000.000000.000020.000230.001430.006170.020280.053720.11894
130.000000.000000.000000.000000.000030.000270.001440.005750.018290.04813
140.000000.000000.000000.000000.000000.000040.000260.001280.004910.01544
150.000000.000000.000000.000000.000000.000000.000040.000210.001000.00377
160.000000.000000.000000.000000.000000.000000.000000.000030.000140.00066
170.000000.000000.000000.000000.000000.000000.000000.000000.000010.00007
180.000000.000000.000000.000000.000000.000000.000000.000000.000000.00000

n = 19

nx0p
0.050.10.150.20.250.30.350.40.450.5
1910.622650.864910.954400.985590.995770.998860.999720.999940.999991.00000
20.245290.579740.801510.917130.968990.989580.996870.999170.999810.99996
30.066550.294560.558680.763110.888660.953780.983040.994540.998470.99964
40.013240.115000.315850.544910.736910.866830.940860.977040.992280.99779
50.002010.035190.144440.326710.534580.717780.850000.930390.972020.99039
60.000240.008590.053700.163060.332240.526140.703240.837080.922290.96822
70.000020.001700.016330.067600.174880.334500.518830.691930.827340.91647
80.000000.000270.004080.023280.077460.181970.334430.512220.683070.82036
90.000000.000040.000840.006660.028750.083920.185490.332520.506020.67620
100.000000.000000.000140.001580.008900.032550.087470.186090.328960.50000
110.000000.000000.000020.000310.002290.010540.034690.088470.184100.32380
120.000000.000000.000000.000050.000480.002820.011440.035230.087130.17964
130.000000.000000.000000.000010.000080.000620.003090.011560.034230.08353
140.000000.000000.000000.000000.000010.000110.000670.003070.010930.03178
150.000000.000000.000000.000000.000000.000010.000120.000640.002760.00961
160.000000.000000.000000.000000.000000.000000.000010.000100.000530.00221
170.000000.000000.000000.000000.000000.000000.000000.000010.000070.00036
180.000000.000000.000000.000000.000000.000000.000000.000000.000010.00004
190.000000.000000.000000.000000.000000.000000.000000.000000.000000.00000

n = 20

nx0p
0.050.10.150.20.250.30.350.40.450.5
2010.641510.878420.961240.988470.996830.999200.999820.999960.999991.00000
20.264160.608250.824440.930820.975690.992360.997870.999480.999890.99998
30.075480.323070.595100.793920.908740.964520.987880.996390.999070.99980
40.015900.132950.352270.588550.774840.892910.955620.984040.995070.99871
50.002570.043170.170150.370350.585160.762490.881800.949050.981140.99409
60.000330.011250.067310.195790.382830.583630.754600.874400.944670.97931
70.000030.002390.021940.086690.214220.391990.583370.749990.870070.94234
80.000000.000420.005920.032140.101810.227730.398970.584110.747990.86841
90.000000.000060.001330.009980.040930.113330.237620.404400.585690.74828
100.000000.000010.000250.002590.013860.047960.121780.244660.408640.58810
110.000000.000000.000040.000560.003940.017140.053170.127520.249290.41190
120.000000.000000.000000.000100.000940.005140.019580.056530.130760.25172
130.000000.000000.000000.000020.000180.001280.006020.021030.058030.13159
140.000000.000000.000000.000000.000030.000260.001520.006470.021410.05766
150.000000.000000.000000.000000.000000.000040.000310.001610.006430.02069
160.000000.000000.000000.000000.000000.000010.000050.000320.001530.00591
170.000000.000000.000000.000000.000000.000000.000010.000050.000280.00129
180.000000.000000.000000.000000.000000.000000.000000.000010.000040.00020
190.000000.000000.000000.000000.000000.000000.000000.000000.000000.00002
200.000000.000000.000000.000000.000000.000000.000000.000000.000000.00000