
Re: Help with probability&stat problem
Posted:
Jun 14, 2007 2:21 PM


> The BASIC program I made, listing presented at this > thread, provides INSTANTANEOUSLY the cumulative > probability even if I enter X=110 (N=110, p=0.2). I > wonder why to prefer the extremely slow .EXEL?. > TWENTY SECONDS when X=30? WHAT AN ETERNITY!!! > ********* > IMPROOVED PROGRAM > > This program (listing below) is able to evaluate the > cumulative probabilities of Bin (p=0.000001, > N=10^6).It spends 10 seconds (circa) to evaluate > F(X=10^6) providing the value 1.0000000000D+000. > > Licas > > > REM "BINcum" > CLS > DEFDBL AZ > PRINT " F(a) = p(X<=a) X=Bin(p, N) " > INPUT " p , N "; p, n > INPUT " a ( a<=n ) "; a > w = p / (1  p) > ante = (1  p) ^ n: s = ante > IF s = 0 THEN GOTO 20 > IF a = 0 THEN GOTO 10 > FOR j = 0 TO n  1 > IF j > a  1 THEN GOTO 10 > post = ante * (n  j) / (j + 1) * w > s = s + post > ante = post > NEXT j > 10 LOCATE 10, 50 > : PRINT USING "##.##########^^^^^"; s > END > 20 PRINT " p(0)=0 "
I can do the calculation in zero seconds, which is much faster than your program. For any Bin(N,p), Prob(X <= N) = 1.
Jack

