Vous êtes sur la page 1sur 2

Homework 1

Brief instructions on how to create and output Rmd file:


• Step1. Install the R Markdown using the command “install.packages(”rmarkdown“)”. (skip this step if
you use RStudio)
• Step2. Go to “File”>>“New File”>>“R Markdown”, choose the default output format to be PDF.
• Step3. Save the new file with the extension .Rmd.
• Step4. Press “Knit” button to generate PDF output.
1. Suppose 20% of all C++ programs have at least one major bug. Out of five programs, what is the
probability that exactly three of them have a major bug?
2. Jack and Jill keep rolling a four-sided die and a three-sided die, respectively. The first player to get the
face having just one dot wins, but if they both get a 1, it is a tie and the play continues. Suppose in
the Nth turn one player wins.
a. Find P(N = 1)
b. Find P(N = 2)
c. Find P(in the first turn both players get a 1 | N = 3)
3. Suppose that a commitee of four people is randomly selected from a group of 20, consisting of 9 men
and 11 women. Assume that each person is equally likely to be chosen. Let X denote the number of
women on the committee.
a. Write out the probability mass function for X. Include only the possible values that X can take.
b. What is the expectation of X?
c. What is the standard deviation of X?
4. Suppose that you throw two six-sided dice. Let X be the sum of the two dice.
a. Write out the probability mass function for X. Include only the possible values that X can take.
b. What is the expectation of X?
c. What is the standard deviation of X?
5. Urn I contains three blue marbles and three yellow ones, while Urn II contains six and seven of these
colors. We draw a marble at random from Urn I and place it in Urn II. We then draw a marble at
random from Urn II.
a. Find P(second marble drawn is blue)
b. Find P(first marble drawn is blue | second marble drawn is blue)
6. Suppose a box contains two pennies, three nickels and five dimes. During transport, two coins fall out,
unseen by the bearer. Assume each type of coin is equally likely to fall out.
a. Find P(at least $0.10 worth of money is lost)
b. P(both lost coins are of the same denomination)
c. What is the expected value of the total amount of money lost?
7. Use simulation to approximate the pmf and cdf of the six-sided dice roll experiment. For this exercise,
please include your code.
a. Simulate n=1000 dice rolls and plot the histogram of the outcome (use hist function with parameter
freq=FALSE)
b. Plot the empirical cdf function using the same outcome (use plot.ecdf function)
8. Suppose that a financial services company creates a security instrument that combines 10 individual
securities. Each individual security has a 1% chance of defaulting each year. For this exercise, please
include your code.

1
a. Suppose that the securities are independent. Run 1000 simulations to estimate the expected
number of securities that will default at least once in a 10 year period. Plot the 1000 simulated
number of defaults in a histogram (use hist function).
b. Now suppose that a default in one year increases the chance that any of the remaining individual
securities defaults by 1% (e.g. if there are two defaults in the first year, the chance of defaulting
the next year is 3% for each of the remaining eight, and maintains at 3% if no more defaults occur
in the subsequent years). An individual security can default multiple times but only increase the
chance by 1% totally. Estimate the expected number of securities that will default at least once in
a 10 year period and plot the 1000 simulated number of defaults in a histogram.

Vous aimerez peut-être aussi