Questions tagged [bernoulli-probability]

Anything related to Bernoulli in the field of probability, such as Bernoulli random variables, Bernoulli probability distribution, Bernoulli random processes, etc.

Anything related to Bernoulli in the field of probability, such as Bernoulli random variables, Bernoulli probability distribution, Bernoulli random processes, etc.

The Bernoulli distribution is a discrete distribution parametrized by a "success" probability $p$. For a Bernoulli distributed random variable $x$, the probability mass function (pmf) takes a value of $p$ at $x=1$, and $(1-p)$ for $x=0$. A concise representation of the pmf is:

enter image description here

The Bernoulli distribution is a special case of the binomial distribution with a single trial ($n=1$).

See, for example, Wikipedia on:

Tag usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics and machine learning.

73 questions
0
votes
0 answers

How to constrain the probabilities of tfp.layers.IndependentBernoulli

The Bernoulli distribution is based on the probabilities that a value is equal to 1. The layer IndependentBernoulli from tensorflow_probability fits these probabilities (in my understanding). However, if gradient descent were to decrease these…
0
votes
0 answers

count number of Bernoulli Probability (0-1) from data in matrix Using R

The first I was create RNG with Additive then using the column 2 for the next get Bernoulli probability with "Xi" Value to Runif it. Additive_RNG<-function(a,z0,c,m,n,p) { { a = readline("Input Value a: ") z0 = readline("Input…
0
votes
1 answer

Bootstrap with rbinom in R takes too long to run

I have been running bootstraps with rbinom for loops in R, but they take too long to run. I want to perform the bootstrap on a dataset with 1,500,000 rows. I want to resample the rows and for each of the resampled rows rbinom two probabilities…
0
votes
0 answers

Error with plotting plotting anBernoulli GLM with predicted

I am trying to plot the significant variable against the probability of conflict (0,1). My Bernoulli #GLM without interaction works without error. My goal is to end with something this but I currently can not get past predicting my…
SDLun
  • 1
  • 1
0
votes
1 answer

Sampling from exponential Bernoulli

Bernoulli is a probability distribution. I need to sample from an exponential bernoulli and returns a binary value (i.e. either 0 or 1). I found this algorithm exponential bernoulli sampling and i want to implement it but i do not understand the…
0
votes
2 answers

Generating Integer Sequences based on a Modified Bernoulli Distribution

I want to use R to randomly generate an integer sequence that each integer is picked from a pool of integers (0,1,2,3....,k) with replacement. k is pre-determined. The selection probability for every integer k in (0,1,2,3....,k) is pk(1-p) where p…
RandomThinker
  • 391
  • 1
  • 6
0
votes
2 answers

C++ Problem when trying to set bernoulli distribution as an output for function

I need my program to simulate bernoulli (p) random variables with ability to change p. If i write smth like this #include #include #include int main() { double prob = 0.1; //let it be const for now, no need to change it…
Ilya68
  • 3
  • 1
0
votes
1 answer

How to build nested conditional logic in Pandas DataFrame?

I have a dataframe where each row contains a list of strings. I have written a function that performs a Bernoulli-type trial on each string, where with some probability (0.5 here) each word is deleted if the trial is a success. See below: import…
cookie1986
  • 865
  • 12
  • 27
0
votes
2 answers

Generate samples from bernoulli(p) using R

Using R, generate data from the Bernoulli(p), for various sample sizes (n= 10, 15, 20, 25, 30, 50, 100, 150, 200), for p = 0.01, 0.4, 0.8 I know how to do it for one case using the rbinom function. Like for the first scenario: rbinom(n=10, size=1,…
Hamed Said
  • 41
  • 1
  • 3
0
votes
1 answer

Plot density histogram of Bernoulli sample and a Bernoulli pmf together

Summary of Question: Why is my density from my sample so different to the pmf and how can I perform this simulation so that the pmf and the sample estimates are similar. Question: I have simulated a sample of independent Bernoulli trials using…
user4933
  • 1,485
  • 3
  • 24
  • 42
0
votes
1 answer

Turning off x% of ACTIVE bits in a binary numpy matrix as opposed to turning off x% of ALL bits

I have a binary numpy matrix and I want to randomly turn off 30% of the matrix, where turning off 30% means to replace 30% of the 1s with 0s. In general, I want to do this many times, so if I do this 5 times I expect the final matrix to have…
crow3487
  • 135
  • 1
  • 10
0
votes
1 answer

Random matrix with diagonal entries 0's and all other entries are 0's and 1's

I tried using the rbern function in R but I realized that the diagonal entries are not all 0's.
0
votes
0 answers

How to sample from two gaussians and combine them given a probability (bernoulli)

Given two different gaussians, how can I create a mixture of the two gaussians where each datapoint is from first gaussian with probability p = 0.3 and from second with probability 0.7 (using a bernoulli distribution for the probabilites). Here is…
0
votes
1 answer

How to create a boolean tensor whose values are drawn from a Bernoulli distribution?

I would like to implement the following function: def bernoulli_tensor(shape, probability) -> tf.Tensor: ...
Stephane Bersier
  • 710
  • 7
  • 20
0
votes
0 answers

Is there a function in R for discrete probability distribution?

I have a set of Bernoulli variables, giving specific values with different probabilities. The variables are independent. I'm trying to build a simple discrete probability table for all the possible outcomes. A short example of the data I have…
Amidavid
  • 177
  • 7