HW1
HW1
1
You are supposed to work primarily in an R and submit results in a form of an html document from R
Markdown including visible script. Failure to do so results in automatic deduction of 3 points. You can add
additional files (Word documents or pics of handwriting) in case you thought you can better express
yourself for some problems, but these should be more of appendices to your main work. In case of
submitting more than one file, use zip compression.
You are supposed to submit your homework via Coursework submission in the InSIS in the term given
there. In case you would not manage this in time, you can send it via e-mail, but each day of delay means
automatic deduction of 1 point.
1) In the 200m dash finals in the Olympics, 8 runners compete for 3 medals (order matters). In the 2012
Olympics, 3 of the 8 runners were from Jamaica and the other 5 were from different countries. The
three medals were all won by Jamaica (Usain Bolt, Yohan Blake, and Warren Weir). Calculate
analytically first two, simulate the last one (1,000 runs).
a. How many different ways can the 3 medals be distributed across 8 runners?
b. How many different ways can the three medals be distributed among the 3 runners from
Jamaica?
c. What is the probability that all 3 medals are won by Jamaica, assuming the position is random?
2) Imagine deck of poker cards – 13 different cards in 4 suits, hence 52 different cards. Obtain results
analytically and via simulations of at least 1,000 runs for each of the following questions.
a. You sample 5 cards at random without replacement, what is a probability of having five
cards of the same suit?
b. You sample 2 cards at random without replacement, what is a probability of having two
Kings?
c. What is a probability of having the second King in the second draw?
d. You sample 5 cards at random without replacement, what is a probability of having exactly
three different suits of one kind of a card.
3) Assuming having a standardized admissions test has a -0.25 point penalty for every incorrect answer
and awards 1 point for a correct answer. The quantitative test consists of 8 multiple-choice questions
each with 5 answer choices. Suppose a student chooses answers by guessing for all questions on the
test.
a. Write down a probability function for total number of points obtained.
b. What is an expected value and what is a standard deviation for total number of points?
c. Simulate 1,000 students taking this test, guessing at random. What is their mean number of
points and sample standard deviation?
4) In a previous example, assume a student knows answers to 80 % of questions.
a. What is his/her expected number of points and standard deviation assuming he/she skips
answering those questions he/she does not know an answer to (and takes automatically 0
points for these)?
b. What is his/her expected number of points and standard deviation assuming he/she answers
randomly those questions he/she does not know an answer to?
c. Simulate 1,000 pairs of students. The first student from the pair knows answers to 80 % of
question and the second knows answers to 90 % of questions. What is the probability, that
the first student has higher number of total points than the second assuming they skip
answering questions they do not know the answer to?
5) For a random variable with following probability density function calculate cumulative distribution
function and quantile function. Calculate expected value, standard deviation, median and inter-
quartile range. Plot probability density function and highlight expected value, median, range of E(X) ±
S.D.(X) and inter-quartile range. Plot cumulative distribution function and quantile function and
highlight quartiles (median included) in both.
3𝑥 2
𝑓(𝑥 ) = for 1 < x < 3
26