I am trying to find the age distribution of the subset of married people of a population. However, I realise that just visualising the married count by age (Figure 1) is highly dependent on the original distribution of ages in the population, as shown in Figure 2.

How can I determine the distribution of a boolean feature like isMarried = True based on the original distribution?

age distribution of married people

age distribution of population

  • $\begingroup$ Wecome to DataScienceSE. Is this homework? $\endgroup$
    – Erwan
    Nov 23, 2021 at 16:58
  • 1
    $\begingroup$ Hi, this is just further personal exploration of a data set that was initially set as a homework task. $\endgroup$
    – Bazoya
    Nov 23, 2021 at 17:23

1 Answer 1


I think you're looking for the conditional probability "married given age".

For any age value $a$, you can calculate:

$$p(Married=true|Age=a)=\frac{p(Married=true \wedge Age=a)}{p(Age=a)}$$

For the calculation you can directly use the frequency instead of the probability:

  • the top part is the number of married people aged $a$
  • the bottom part is the total number of people aged $a$

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.