
Re: Help with probability&stat problem
Posted:
Jun 15, 2007 11:37 AM


> Prob. that X belongs to an interval > > > A routine (BIN2) for the evaluation of the > e probability that X~Bin (p, N) be inside [a, b] i.e. > > ________p ( a<=X<=b)__________b>=a > is presented below. > Note that if b=a then we get p(X=a). The routine > inputs are p, N , b, a. > > > 1) _______p=.7, N=7, b=7 , a=0 > _RESULT: 1.0000000000D+000 > (I think that, this time, Jack?s *sense of humour * > shall not be triggered, surely). > > 2)_______p=.7, N=7, b=6, a=1 > _R: 9.1742700000D001 (or 0.917427 evidently). > > ______Licas > > > > REM "BIN2" > CLS > DEFDBL AZ > PRINT " b >= a " > PRINT " p(a<=X<=b) = F(b)F(a1) " > INPUT " p , N "; p, n > INPUT " b= "; w(1) > INPUT " a= "; a: w(2) = a  1 > r = p / (1  p) > FOR u = 1 TO 2 > ante = (1  p) ^ n: s = ante > FOR j = 0 TO n  1 > IF j > w(u)  1 THEN GOTO 10 > post = ante * (n  j) / (j + 1) * r > s = s + post > ante = post > NEXT j > 10 w(u) = s > NEXT u > PRINT " p(a<=X<=b) = F(b)F(a1) "; > IF a = 0 THEN w(2) = 0 > PRINT USING "##.##########^^^^^"; w(1)  > ; w(1)  w(2) > COLOR 7 > END
So you now agree with me that the OP should use the exact binomial probability of 0.9753 rather than your approximation of 0.9786.
Jack

