I have the following example data, where each row is an independent observation:

10 22 6 2
4 60 2 0
12 8 10 3

$A$, $B$, $C$ and $Y$ are all positive integers. The variables $A$, $B$ and $C$ represent the number of samples from a corresponding Bernoulli distribution: $\textrm{Bernoulli}(p_A)$, $\textrm{Bernoulli}(p_B)$, and $\textrm{Bernoulli}(p_C)$ respectively. Here, $p_i \ne p_j, \forall i,j \in \{A, B, C\}, i \ne j$ and $p_i$ is the same for each observation. The variable $Y$ represents the number of successes across all $A + B + C$ trials, that is:

$$Y = Y_A + Y_B + Y_C$$

where $Y_A$, $Y_B$ and $Y_C$ represent the number of successes for the $A$, $B$ and $C$ trials respectively (i.e. they are Binomially distributed). However, $Y_A$, $Y_B$ and $Y_C$ are unknown.

I am trying to model the $p_i$ parameter values in a Bayesian manner. The problem I see is that the $Y_i$ random variables have a different number of trials depending on the data observation. I take this to mean that rather than modelling $Y_i \sim \textrm{Binomial}(n_i, p_i)$ I would actually have to model $Y_{ij} \sim \textrm{Binomial}(n_{ij}, p_i)$, where $j$ corresponds to the index of the observation. Therefore, I would have a different random variable for each row in the data, which is not feasible given there would (in general) only be a single observation per distribution. Am I correct about this assumption? Regardless, how should I go about generating distributions for $p_i$ (perhaps by fitting a Beta distribution to each $p_i$)? Is it even possible, given the data?

I am very new to probabilistic modeling so I apologize if this problem is trivial or my understanding of key concepts is incorrect.

  • 1
    $\begingroup$ What do you mean by "generating distributions for $p_i$"? Are you trying to do some kind of inference on the $p_i$? Maximum likelihood inference? Some kind of Bayesian inference, and if so, with what prior? Why is "not feasible" to have a different random variable for each row? $\endgroup$
    – D.W.
    Commented Sep 19, 2022 at 4:07
  • $\begingroup$ What does $p_i,p_j$ represent? $\endgroup$
    – D.W.
    Commented Sep 19, 2022 at 4:31
  • $\begingroup$ @D.W. Thanks for the help. I have edited the question to explain more clearly what I'm trying to do. $\endgroup$
    – duncster94
    Commented Sep 19, 2022 at 10:52
  • $\begingroup$ Sums of independent binomials with different p's are called the poisson-binomial-distribution. You can peruse that tag! $\endgroup$ Commented Sep 19, 2022 at 14:10

1 Answer 1


Let $A_i,B_i,C_i,Y_i$ denote the values in the $i$th row. If $p_A,p_B,p_C$ are the same in all rows, then the appropriate model is

$$Y_i \sim \text{Bernoulli}(A_i,p_A) + \text{Bernoulli}(B_i,p_B) + \text{Bernoulli}(C_i,p_C).$$

If $p_A,p_B,p_C$ are not the same for all rows, then let $p_{A,i},p_{B,i},p_{C,i}$ denote the corresponding probabilities for all rows. Then the appropriate model is

$$Y_i \sim \text{Bernoulli}(A_i,p_{A,i}) + \text{Bernoulli}(B_i,p_{B,i}) + \text{Bernoulli}(C_i,p_{C,i}).$$

In the latter case, the data you have will not be enough to (uniquely) predict the $p$ values; there will be many possible $p$ values that are consistent with the observed data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.