Professional Documents
Culture Documents
Homework 1 - Solution
Homework 1 - Solution
Homework 1 - Solution
General Instructions. Due Sunday, September 13 th at 11:59pm. Please submit your code and a log of
your output for Part TWO. For Part ONE submit an electronic version through Canvas. The TA will grade
these for completeness.
Part ONE
Consult Chapter 1 and Chapter 2 of OpenIntro Statistics from the syllabus for Topics we’ve covered.
Chapter 1 is Introduction to Data and Chapter 2 is on Probability.
Short Questions
1. If the we roll a 4-sided die and an 8 sided-die simultaneously. Use the chart to compute the
probabilities for the following events:
a) P (1,1)=1/32
b) P (sum=5)=4/32
c) P (sum>9)=6/32
d) P (sum=odd)=16/32
e) P (sum=5 or sum>9)=10/32
2. Suppose you flip a coin 5 times, observing heads (H) or tails (T) on each flip. Define X to be a
Random Variable that equals 1 if the coin comes up heads at least one time and 0 otherwise.
Compute the expected value of X , denoted E [X ].
The distribution of X is
X 0 1
P[X=x] 1/32 31/32
Begin by setting the seed, so that the results can be replicated. Run the command set.seed(5030)
to do this.
1. Sample spaces.
a. Following the example of a five-sided die from class, generate a sample space for an
eight-sided die, and save it in an object called S_oct.
b. Generate a sample space of a coin with outcomes labeled “H” and “T.” Save in an object
named S_coin.
2. Sampling
a. Draw a sample of size = 100 observations from the discrete RV sample spaces in (1).
Store in objects labeled X_oct and X_coin.
b. Draw a sample of size = 100 observations from the following continuous distributions:
i. Uniform[-1,+1]. As in Class_1_code file, use the runif() function. Store in
object labeled X_uni.
ii. Normal(mean = 5, sd = 1). Similar to the uniform, use the rnorm() function.
Store the result in an object labeled X_norm.
1. Tip: To learn about how to use rnorm(), type the command
help(rnorm). There are lots of options, but only a few that you’ll
need to use/ specify. By comparison, look at help(runif).