Basic probability theory notation and terms
This can be trivial or you may need to refresh your memory on these concepts (see, e.g. Aalto course First Course in Probability and Statistics). Explain each of the following terms with one sentence:
- probability
- probability mass (function)
- probability density (function)
- probability distribution
- discrete probability distribution
- continuous probability distribution
- cumulative distribution function (cdf)
- likelihood
- Q3:
How is the answer?
- Totally wrong/has not tried
- Something sensible written
- All/almost all are correct (>=70% correct)
Basic computer skills
This task deals with elementary plotting and computing skills needed during the rest of the course. You can use either R or Python, although R is the recommended language in this course and we will only guarantee support in R. For documentation in R, just type ?{function name here}
.
Plot the density function of the Beta-distribution, with mean \(\mu = 0.2\) and variance \(\sigma^2=0.01\). The parameters \(\alpha\) and \(\beta\) of the Beta-distribution are related to the mean and variance according to the following equations \[\begin{aligned}
\alpha = \mu \left( \frac{\mu(1-\mu)}{\sigma^2} - 1 \right), \quad
\beta = \frac{\alpha (1-\mu) }{\mu} \,.\end{aligned}\]
Take a sample of 1000 random numbers from the above distribution and plot a histogram of the results. Compare visually to the density function.
Compute the sample mean and variance from the drawn sample. Verify that they match (roughly) to the true mean and variance of the distribution.
Estimate the central 95% probability interval of the distribution from the drawn sample.
- Q4:
Is the source code for the solutions included?
- Q5:
Does the plot in a) look something like this: …
- Q6:
Does the plot in b) look something like this: …
- Q7:
Is the computed mean in c) close to …?
- Q8:
Is the variance in c) close to …?
- Q9:
Is the probability interval in d) roughly …? Remember that since the interval is computed from random sample, there can be small variation, but the answers should be roughly the same!
- Please try to include as much code and output as needed, but as little as possible.
- Please make sure that the plots are properly labeled and are easily legible and understandable. This means
- they should have x- and y-labels,
- the text within should be of a size comparable to the size of the surrounding text and
- each plot should have a concise but descriptive caption or title.
- Please make sure to report a sensible number of digits when reporting numbers. You will get more precise instructions later on, but for now think independently about how many digits of your results are important for the assignment.
Bayes’ theorem 1
A group of researchers has designed a new inexpensive and painless test for detecting lung cancer. The test is intended to be an initial screening test for the population in general. A positive result (presence of lung cancer) from the test would be followed up immediately with medication, surgery or more extensive and expensive test. The researchers know from their studies the following facts:
- Test gives a positive result in \(98\%\) of the time when the test subject has lung cancer.
- Test gives a negative result in \(96\%\) of the time when the test subject does not have lung cancer.
- In general population approximately one person in 1000 has lung cancer.
The researchers are happy with these preliminary results (about \(97\%\) success rate), and wish to get the test to market as soon as possible. How would you advise them? Base your answer on Bayes’ rule computations.
Relatively high false negative (cancer doesn’t get detected) or high false positive (unnecessarily administer medication) rates are typically bad and undesirable in tests.
Here are some probability values that can help you figure out if you copied the right conditional probabilities from the question.
- P(Test gives positive | Subject does not have lung cancer) = \(4\%\)
- P(Test gives positive and Subject has lung cancer) = \(0.098\%\) this is also referred to as the joint probability of test being positive and the subject having lung cancer.
- Q10:
Is p(has cancer|test result is positive) computed using Bayes’ formula (or its complement p(does not have cancer|test result is positive))?
- Q11:
Is the result p(has cancer|test result is positive)=… (or p(does not have cancer|test result is positive)=…)
- Q12:
Is the result motivated with something like …
Bayes’ theorem 2
We have three boxes, A, B, and C. There are
- 2 red balls and 5 white balls in the box A,
- 4 red balls and 1 white ball in the box B, and
- 1 red ball and 3 white balls in the box C.
Consider a random experiment in which one of the boxes is randomly selected and from that box, one ball is randomly picked up. After observing the color of the ball it is replaced in the box it came from. Suppose also that on average box A is selected 40% of the time and box B \(10\%\) of the time (i.e. \(P(A) = 0.4\)).
What is the probability of picking a red ball? Implement an R function to compute that probability.
If a red ball was picked, from which box did it most probably come from? Implement an R function to compute the probabilities for each box.
- Q13:
Is the source code available?
- Q14:
How is the answer for probability of picking a red ball?
- No answer
- Probability rules … and … used, but the result is not …
- Probability rules … and … used, and the result is …
- Q15:
How is the answer for what box is most probable?
- No answer
- Bayes rule used to compute probabilities for all boxes given that the picked ball is red, but the answers are not …
- Bayes rule used to compute probabilities for all boxes given that the picked ball is red, the answers are p… and it is not explicity said that the most probable box is box …
- Bayes rule used to compute probabilities for all boxes given that the picked ball is red, the answers are … and it is explicity said that the most probable box is box …
Bayes’ theorem 3
Assume that on average fraternal twins (two fertilized eggs and then could be of different sex) occur once in 150 births and identical twins (single egg divides into two separate embryos, so both have the same sex) once in 400 births (Note! This is not the true value, see Exercise 1.6, page 28, in BDA3). American male singer-actor Elvis Presley (1935 – 1977) had a twin brother who died in birth. Assume that an equal number of boys and girls are born on average.
What is the probability that Elvis was an identical twin? Show the steps how you derived the equations to compute that probability and implement a function in R that computes the probability.
- Q16:
How is the answer for probability of Elvis having had an identical twin brother?
- No answer
- Probability that Elvis had an identical twin brother is computed using Bayes rule, but the result is not roughly …
- Probability that Elvis had an identical twin brother is computed using Bayes rule, and the result is roughly …
The three steps of Bayesian data analysis
Fill in the three steps of Bayesian data analysis (see BDA3 section 1.1):
- …
- …
- …
- Q17:
Are the three steps listed as follows:
- …
- …
- …
Overall quality of the report
- Q18:
Does the report include comment on whether AI was used, and if AI was used, explanation on how it was used?
- Q19:
Does the report follow the formatting instructions?
- Not at all
- Little
- Mostly
- Yes
- Q20:
In case the report doesn’t fully follow the general and formatting instructions, specify the instructions that have not been followed. If applicable, specify the page of the report, where this difference is visible. This will help the other student to improve their reports so that they are easier to read and review. If applicable, specify the page of the report, where this difference in formatting is visible.
- Q21:
Please also provide feedback on the presentation (e.g. text, layout, flow of the responses, figures, figure captions). Part of the course is practicing making data analysis reports. By providing feedback on the report presentation, other students can learn what they can improve or what they already did well. You should be able to provide constructive or positive feedback for all non-empty and non-nonsense reports. If you think the report is perfect, and you can’t come up with any suggestions how to improve, you can provide feedback on what you liked and why you think some part of the report is better than yours.