Questions tagged [binomial-cdf]

48 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
  • 33,862
  • 40
  • 131
  • 218
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…
6
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
  • 12,857
  • 13
  • 46
  • 81
5
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,069
  • 9
  • 22
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 :)
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
  • 226
  • 3
  • 8
4
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
  • 425
  • 2
  • 13
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
  • 6
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
  • 265
  • 5
  • 13
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
  • 313
  • 1
  • 15
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
  • 4
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
  • 375
  • 1
  • 7
2
votes
3 answers

Find the two points on the x-axis corresponding to the intersections for a cdf

The corresponding r code is given below. theta <- seq(0,1, length = 10) CD_theta <- function(x, p, n){ 1 - pbinom(x, size = n, prob = p) + 1 / 2 * dbinom(x, size = n, prob = p) } Then I graphed the data as follows : mytheta <- CD_theta(5, theta,…
score324
  • 591
  • 4
  • 18
2
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
  • 4,460
  • 8
  • 38
  • 74
2
votes
2 answers

Enumerate all possible combined probabilities of a series of Bernoulli trials with different probabilities

Suppose I have a series of n probabilities for success of independent Bernoulli trials, p1 to pn such that p1 != p2 != ... != pn. Give each trial a unique name. p <- c(0.5, 0.12, 0.7, 0.8, .02) a <- c("A","B","C","D","E") I know from…
paqmo
  • 3,439
  • 1
  • 9
  • 20
1
2 3 4