Is there any way to construct an expected conditional probability distribution of the form p(x|(y,z)) if I am starting with p(x|y) and p(x|z)? All variables are categorical.

My specific problem deals with a DNA multiple-sequence alignment. Abstractly, I have a two-dimensional dataset, where each position can hold one of four values {G,A,C,T}. The rows are genomes and the columns are aligned positions in the different genomes. I want a way to judge if the observed value is surprising given what I know about the row and column in which it is observed. My intention is to identify regions of a chromosome (a portion of a row, ~1000 columns wide) where the observed values would not have been predicted based on the characteristics of the row and the specific columns. I can easily infer the probability of observing a given outcome (e.g. x = G) for both the row and the column, but I don't know how I would merge those expectations into a single set of expected frequencies.

I would like to say that I am assuming that Y and Z are independent, but I don't know if that's meaningful in this scenario. One obvious constraint is that if a particular outcome is forbidden by one of the predictors, then it cannot occur at the intersection of the two predictors. For example, if the column is uniform (e.g. the genomes are monomorphic) then it doesn't matter what the probability distribution is for the row in question.

I feel like I'm missing something obvious, and I have an intuitive solution but am unable to prove it to myself. Any suggestions would be appreciated.

  • $\begingroup$ Why don't you just measure column-wise? If a column is 99% G and Bob has an A, then Bob is weird, at least at that position. I'm having trouble seeing how the row enters into it at all. What difference would it make whether Bob has 99% G or 99% A in his row in my example? Is the idea that you might dismiss the fact that Bob is weird at this particular position because Bob is weird overall? $\endgroup$
    – Bill
    Commented Apr 24, 2014 at 18:31
  • $\begingroup$ @Bill: That is basically how I'm dealing with it -- "Bob always has an A; that's just how he is, nothing to see here". My ultimate goal is to incorporate more information about how the sites (columns) and individuals (rows) relate to each other... but I feel like this adjustment is a major sticking point. $\endgroup$
    – adam.r
    Commented Apr 24, 2014 at 19:05
  • $\begingroup$ It sounds like you're looking to determine whether the values at a given position are at random, or if certain values in {G,A,C,T} occur with non-random frequency in a some positions within each genome, is that correct? $\endgroup$ Commented Apr 24, 2014 at 20:58
  • 3
    $\begingroup$ In general you can't combine $p(x|z)$ and $p(x|y)$ to get $p(x|y,z)$. It doesn't even work with expectation, which is why we don't replace two way anova with two one-way anovas. $\endgroup$
    – Glen_b
    Commented Apr 25, 2014 at 1:34
  • 2
    $\begingroup$ That's exactly the situation I am talking about. See Simpson's paradox, for example, especially the first diagram. $\endgroup$
    – Glen_b
    Commented Apr 26, 2014 at 7:41

2 Answers 2


The solution is to treat p(x|y) and p(x|z) as independent distributions, and then focus on the subset of outcomes that meet the constraint that the conditional distributions produced the same outcome.

So... p(x=G|(y,z)) = p(x=G|y) * p(x=G|z) / S where S is the sum over all possible outcomes {G,A,C,T}.

This was actually my intuitive answer, but I couldn't express the reasoning.


With logistic regression you can do something similar. The row and the column can be the independent variables. If you work without interaction, then the number of parameters you need to estimate is the same as in logistic regression.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.