cumbin(x,N,P [,upper:T or lower:F]), x, N and P REAL, elements of N integers > 0, elements of P between 0 and 1 |

cumbin(Val,N,P) computes the probabilities that a binomial random variable with N trials at probability P would be <= elements of the vector, matrix or array Val. When Val is not integral, the result is the same as cumbin(floor(Val),N,P). Any of Val, N, and P that are not scalars (single numbers) must be vectors, matrices, or arrays with the same size and shape which will also be the size and shape of the result. The elements of N must be positive integers less than 100,000 and the elements of P must be between zero and one. cumbin(Val,N,P,upper:T) and cumbin(Val,N,P,lower:F) compute the probability that the binomial random variable is >= elements of Val. This is mathematically the same as 1 - cumbin(ceiling(Val - 1),N,P), not 1 - cumbin(Val,N,P) Note that when Val is an integer, P(x = Val) is included in both cumbin(Val,N,P) and cumbin(Val,N,P,upper:T). If x_obs is an observed number of successes in a sequence of n independent trials with constant p = P(success), you can use cumbin() to compute P-values for a test of H_0: p = p_0 as follows: H_a P-value p > p_0 cumbin(x_obs,n,p_0,upper:T) p < p_0 cumbin(x_obs,n,p_0) p != p_0 2*min(cumbin(x_obs,n,p_0),cumbin(x_obs,n,p_0,upper:T)) Example: Cmd> 1 - cumbin(7,13,.25) # P(x > 7) with n = 13, p = .25 (1) 0.0056493 Cmd> cumbin(8,13,.25,upper:T) # or cumbin(8,13,.25,lower:F), same (1) 0.0056493 See also cumpoi(). See invbeta:"binomical_confidence_interval" for information on computing a confidence interval for p based on a binomial random variable

Gary Oehlert 2003-01-15