Questions tagged [binomial-cdf]
58 questions
18
votes
10 answers
How can I efficiently calculate the binomial cumulative distribution function?
Let's say that I know the probability of a "success" is P. I run the test N times, and I see S successes. The test is akin to tossing an unevenly weighted coin (perhaps heads is a success, tails is a failure).
I want to know the approximate…

sanity
- 35,347
- 40
- 135
- 226
7
votes
2 answers
Calculating the probability of system failure in a distributed network
I am trying to build a mathematical model of the availability of a file in a distributed file-system. I posted this question at MathOverflow but this might as well be classified as a CS-question so I give it a shot here as well.
The system works…

Yrlec
- 3,401
- 6
- 39
- 75
7
votes
3 answers
Beta Binomial Function in Python
I would like to calculate the probability given by a binomial distribution for predetermined x(successes), n(trials), and p(probability) - the later of which is given by a probability mass function Beta(a,b).
I am aware of…

TheChymera
- 17,004
- 14
- 56
- 86
6
votes
1 answer
Julia, function to replicate "rbinom()" in R
I have dug around and googled but not found an example. I'm sure Julia has a powerful function (in base?) to generate random binomial (bernoulli?) "successes" with a given probability. I can't find it or figure out how to do the equivalent to in…

Jim Maas
- 1,481
- 2
- 16
- 36
6
votes
2 answers
Fit beta binomial
I have been looking for a way to fit data to a beta binomial distribution and estimate alpha and beta, similar to the way the vglm package in VGAM library does. I have not been able to find how to do this in python. There is a scipy.stats.beta.fit()…

user3266890
- 465
- 5
- 15
4
votes
5 answers
Binomial coefficient
'Simple' question, what is the fastest way to calculate the binomial coefficient? - Some threaded algorithm?
I'm looking for hints :) - not implementations :)

Skeen
- 4,614
- 5
- 41
- 67
4
votes
1 answer
R binom.test roundoff error?
I’m confused about the operation of binom.test.
Say I want to test a sample of 4/10 success against p=0.5.
The P value should be:
P(X <= 4) + P(X >=6)
or
P(X <= 4) + 1-P(X <= 5)
and indeed:
>pbinom(4,10,p=0.5) + 1-pbinom(5,10,0.5)
[1]…

turtlegraphics
- 296
- 3
- 8
4
votes
1 answer
Discrete probability distribution calculation in Matlab
I have given P(x1...n) discrete independent probability values which represent for example the possibility of happening X.
I want a universal code for the question: With which probability does happening X occur at the same time 0-n times?
For…

Clemens
- 245
- 1
- 7
3
votes
3 answers
rbinom; How to ensure at least one "success" is returned?
Is there a way to ensure rbinom() returns at least one success?
I am running rbinom() with a really low probability:
rbinom(5015, size=2, prob= 1/5000))
Since it is a probability distribution, there is a chance all 0s are returned. Is there a way…

Sky Scraper
- 148
- 1
- 10
3
votes
1 answer
Binomial test in Python vs R
I am trying to re-implement a binomial test initialy developed in R with Python. However, I am not sure if I am using the right functionality.
In R, I get:
> binom.test (2, 8, 11/2364, alternative = "greater")
0.25
With Python & SciPy, I use
from…

El Dude
- 5,328
- 11
- 54
- 101
3
votes
0 answers
How do I find "prob=?" in this equation pbinom(q=5,size=10,prob=?,lower.tail=FALSE)=.1?
How do I solve for the "prob=" parameter of pbinom() if I want pbinom() to equal a specific value and I assume values for "q=" and "size=" parameters? Let's assume that I want pbinom() to equal 0.1 when I have q=5, size=10, and lower.tail=FALSE, is…

Ursus Frost
- 405
- 1
- 7
- 14
2
votes
2 answers
Efficient sampling from a 'partial' binomial distribution
I am want to sample from the binomial distribution B(n,p) but with an additional constraint that the sampled value belongs in the range [a,b] (instead of the normal 0 to n range). In other words, I have to sample a value from binomial distribution…

Black Jack 21
- 315
- 4
- 19
2
votes
2 answers
Is there a way to find the probability p with R for pbinom
I think this is a rather common problem, but I could not find a solution.
I want to solve the following equation:
pbinom(18,25,p)=0.05.
Is there a way to find the unknown p with the program R?
Every help is appreciated.

garondal
- 123
- 5
2
votes
1 answer
How to generate random number 1 & 2 instead of 0 & 1 from binomial distribution?
I would like to generate random number from binomial 1 or 2 instead of the usual 0 and 1. Normally we will use rbinom(10, 1, 0.4) to generate either 0 or 1, but is it possible to generate 1 and 2? Or is there any way to convert it?

Elvis
- 405
- 1
- 4
- 13
2
votes
0 answers
brms family binomial: Weird behavior with trials in formula? Error: ... requires integer responses
In R's glm() function you can fit a logistic regression (with family = binomial) by using a "column specification" of the response variable like so:
glm(cbind(success, (n - sucess)) ~ 1, family = binomial, ...)
The documentation of brmsformula…

MrMax
- 393
- 1
- 2
- 10