05 Probabilities I

Introduction / refresher of some probabilities concept + α,β exercise solution

Exercise for bonus points:

  • Calculate some probabilities about siblings
  • submit your solution to BRUTE lab05quiz by March 20, midnight
  • format: text file, photo of your solution on paper, pdf - what is convenient for you
  • solution will be discussed on the next lab
  • 0.5 points
  • Students with their family name starting from A to K (included) have to solve and upload subject A , while students with family name from L to Z have to solve and upload subject B.

Exercise II / Solving together

Random variable, mean value

In certain board game, the dice are rolled in the following way:

  • We roll the die a first time.
  • If we get an odd number, we roll a second time.
  • The value of such a roll is denoted as H and it is the highest number that was rolled (i.e. the even number that was rolled on the first roll, or the greater of the numbers from both rolls if an odd number was rolled the first time).

What is the mean (expected) value of such a roll? Try to solve first theoretically and then by simulation.

Solution via theory


  1. First, define the space $\cal S$ of elementary events (outcomes of the experiment).
  2. Determine the probabilities of these elementary events. Are they all the same? What should their sum be? Is this condition met?
  3. Define the random variable (r.v.) $H$, i.e. determine what real value $H(s)$ is assigned to each elementary event $s \in \cal S$.
  4. What is the support of r.v. $H$? (that is, which real values will have a non-zero probability?)
  5. Define the probability distribution of r.v. $H$, i.e. determine the value of the function $p_H(x)$ for all values of $x$.
  6. Determine the expected value $E(H)$ of r.v. $H$.
Solution via simulation


  1. Create a function that will return a single value of $H$ according to the above rules.
  2. Find out the results of many such rolls and calculate their average.
  3. Try to run the script many times and observe differences in the estimated $E(X)$.

Probability and simulation

If you have time, try to solve other probability problems by simulation, e.g:

  • The probability for a family to have two daughters, one of whom is born on a Monday (see the 3rd bonus exercise question).
  • A task about a screening test for a disease X (try to randomly generate people, determine whether they have the disease or not according to a given probability, determine whether they test positive or negative according to known conditional probabilities, and estimate what proportion of people with a test that came out positive really had the disease);
  • A problem about the probability that a student will catch the bus if he arrives at the bus stop anytime between 6:58 and 7:02, while the bus leaves anytime between 7:00 and 7:03.
    • “anytime” here means that you are to assume a uniform distribution.
    • How would the simulation change if the equal distribution of the student's arrival time at the bus stop and bus departure time were changed, for example, to a normal distribution?

Exercise III / Solving together

Conditional probability, Bayes theorem

Although I don't have any symptoms yet, I'm worried about disease X. I'm considering getting tested for it, but haven't yet. I therefore want to study the following phenomena:

  • $X$ - the person is sick (has disease X)
  • $\bar X$ - the person is healthy (does not have disease X)
  • $\ominus$ - the test for disease X came out negative (according to the test, the person does not have disease X)
  • $\oplus$ - the test for disease X came out positive (according to the test, the person has disease X)

For the test I'm considering taking, the manufacturer says it has 90% accuracy for both healthy and sick people. The prevalence of disease X in the population is 5%. Try to answer the following questions:

  1. What is the probability that a person randomly selected from the population has disease X?
  2. What is the probability that I have disease X?
  3. How to understand (and denote) test information from the manufacturer?
  4. What is the probability that I have disease X if I test positive?
  5. What is the probability that I have disease X if I test negative?
courses/be5b33kui/labs/weekly/week_05.txt · Last modified: 2024/02/13 14:35 by gamafili