Skip to content
Prev 296145 / 398506 Next

inverse binomial in R

On 12-05-31 9:10 AM, anna freni sterrantino wrote:
I don't think base R has a function like that, though some contributed 
package probably does.  If you're writing it yourself you'd need to use 
uniroot or some other solver, e.g

invbinomial <- function(n, k, p) {
   uniroot(function(x) pbinom(5, 10, x) - p, c(0, 1))
}