A R and Stata implementation of a generalized binomial test