Computational Formulas for R


The Binomial Distribution

EventR formula
exactly k successesdbinom(k,n,p)
k or fewer successespbinom(k,n,p)
at least k successes1-pbinom(k-1,n,p)
more than k successes1-pbinom(k,n,p)
fewer than k successespbinom(k-1,n,p)
fewer than j or more than k successes1+pbinom(j-1,n,p)-pbinom(k,n,p)
between j and k successes (inclusive)pbinom(k,n,p)-pbinom(j-1,n,p)

The Geometric Distribution


EventR formula
first success on the kth trialdgeom(k-1,p)
first success on or before the kth trialpgeom(k-1,p)
first success before the kthtrialpgeom(k-2,p)
first success on or after the kthtrial1-pgeom(k-2,p)
first success after the kthtrial1-pgeom(k-1,p)
first success between the jth and kth trial, inclusivepgeom(k-1,p)-pgeom(j-2,p)
first success before the jth trial or after the kth trial1+pgeom(j-2,p)-pgeom(k-1,p)

The Negative Binomial Distribution

EventR formula
rth success on the kth trialdnbinom(k-r,r,p)
rth success on or before the kth trialpnbinom(k-r,r,p)
rth success before the kthtrialpnbinom(k-r-1,r,p)
rth success on or after the kthtrial1-pnbinom(k-r-1,r,p)
rth success after the kthtrial1-pnbinom(k-r,r,p)
rth success between the jth and kth trial, inclusivepnbinom(k-r,r,p)-pnbinom(j-r-1,r,p)
rth success before the jth trial or after the kth trial1-pnbinom(k-r,r,p)+pnbinom(j-r-1,r,p)

The Poisson Distribution

EventR formula
exactly kdpois(k,l)
k or lessppois(k,l)
at least k1-ppois(k-1,l)
more than k1-ppois(k,l)
less than kppois(k-1,l)
less than j or more than k1+ppois(j-1,l)-ppois(k,l)
between j and k (inclusive)ppois(k,l)-ppois(j-1,l)

The Normal Distribution

EventR formulaSpreadsheet Formula
Y is less than ypnorm(y,mu,sigma)=NORMDIST(y,mu,sigma,TRUE)
Y is greater than y1-pnorm(y,mu,sigma)=1-NORMDIST(y,mu,sigma,TRUE)
Y is greater than y or less than z1-pnorm(y,mu,sigma)+pnorm(z,mu,sigma)=1-NORMDIST(y,mu,sigma,TRUE)+NORMDIST(z,mu,sigma,TRUE)
Y is between z and ypnorm(y,mu,sigma)-pnorm(z,mu,sigma)=NORMDIST(y,mu,sigma,TRUE)-NORMDIST(z,mu,sigma,TRUE)