0

I am attempting to create a function to calculate the binomial formula, but I keep getting the error "Range out of value in gamma fn"

mything <- function(x, n, p) {
  a = choose(n, x)
  b = p^x
  c = (1 - p)^(n - x)
  d = a * b * c
  return(d)
}

mything(20, 2000, 0.01)
Samuel-Rosa
  • 339
  • 3
  • 10
Dave
  • 17
  • 3

0 Answers0