Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Problem Set #1

Analytical Statistics

Instructions: You must submit your problem set as a single electronic document. It must be clear and easy to read to receive full credit. For the R section, you must submit both the code you wrote and the results you got (see the demonstrations for an example). If you are copy-pasting R code

into a word or google document, use Courier or a fixed width font. The formatting will transmit much better.

1. I flip three coins, a penny, a nickel, and a dime. Each one has both a tails side and a heads side. Write down the following:

(a)  The sample space

(b)  The sample outcomes that make up the event A that two of the three coins land on heads.

(c)  The sample outcomes that make up the event  B  that the coins landing on heads have  greater  value  than  the  coins  landing  on  tails.     (For  example,  if  the  dime landed on heads and the nickel and penny landed on tails, the coins landing on heads would add up to 10 cents, higher than the coins landing on tails, which add up to six cents.)

(d) Find P (A) and P (B )

(e) Find P (A n B) and P (A u B)

2. Let A and B be two events within the sample space of an experiment. We know the following things to be true:

●  P (A) = .1

●  P (BC ) = .4

●  P (A n B) = .05

Based on this, find the following:

(a)  P (AC )

(b)  P (B )

(c)  P (A u B)

(d)  P (B n AC )

(e) p(AC ]B)

(f)  P (B]A)

3.  Three randomly chosen people decide to check the calendar from the year they were born to see what day of the week they were born on (Monday, Tuesday, Wednesday, ...). What is the probability that at least two of them were born on the same day of the week?

4.  Suppose you are trying to create a spam filter for your email inbox. You know the following facts:

●  1 out of 800 spam emails contain the words “get rich fast”

●  1 out of 2 emails are spam emails

●  1 out of 1,200 emails contain the words “get rich fast”

(a) What is the probability a random email both is a spam email and contains the words “get rich fast” ?

(b) What is the probability a random email both is not a spam email and contains the words “get rich fast”?

(c) If an email contains the words “get rich fast”, what is the probability it is a spam email? What is the probability it is not a spam email?

R Exercise

1.

(a)  Simulate the process of flipping three coins, a penny, a nickel, and a dime and to do

it 10,000 times. To help you with this, I will show you an example of how to simulate flipping three coins 10 times. Instead of generating vectors with the words “Heads” or “Tails,” I will generate vectors of 0’s and 1’s, with 0 signifying tails and 1 signifying heads.

>penny  <-  sample(x  =  c(0,  1),  size  =  10,  replace  =  T)

>  nickel  <-  sample  (x  =  c(0,  1),  size  =  10,  replace  =  T)

>  dime  <-  sample(x  =  c(0,  1),  size  =  10,  replace  =  T)

>

>  ten_flips  <-  data.frame(penny,  nickel,  dime)

>  ten_flips

1

2

3

4

5

6

7

8

9

10

penny

0

0

0

1

0

0

0

0

1

0

nickel

0

0

0

1

1

0

1

1

0

1

dime

1

0

0

0

0

1

0

1

0

1

(b)  Determine which flips are in A and B .

In problem (1) above, we defined two events:

i.  A: the event that two of the three coins lands on heads.

ii.  B :  the event that the coins landings on heads are higher in value than the coins landing on tails.

For your simulation of 10,000 flips of the three coins, determine whether each one falls into event A, which ones fall into event B , which are in both.

To help you, I will show you how to determine whether each of the ten coin flips are in event A:

>  ten_flips$A  <-  with(ten_flips,  penny  +  nickel  +  dime  ==  2) >  ten_flips

 

penny

nickel

dime

A

1

0

0

1

FALSE

2

0

0

0

FALSE

3

0

0

0

FALSE

4

1

1

0

TRUE

5

0

1

0

FALSE

6

0

0

1

FALSE

7

0

1

0

FALSE

8

0

1

1

TRUE

9

1

0

0

FALSE

10

0

1

1

TRUE

(c) Find the number of flips where A occurs.

Here is a demonstration using the 10 flips previously simulated:

>  summary(ten_flips$A)

Mode

logical

FALSE

7

TRUE

3

(d)  Figure out which flips are in B.  The most straightforward way to do this is to first compute the value of coins landing heads and the value landing on tails.  Below is a demonstration of finding the value of the coins landing on heads:

>  ten_flips$value_heads  <-  with(ten_flips,  penny  +  5  *  nickel  +  10  *  dime)

Next we need the value landing on tails. The value of all the coins together is 16 cents (10 + 5 + 1), so the value of the coins landing on tails is simply 16 minus the value of the coins landing on heads.

>  ten_flips$value_tails  <-  with(ten_flips,  16  -  value_heads)

Event B occurs when the value of the coins landing on heads is higher than the value of the coins landing on tails:

>  ten_flips$B  <-  with(ten_flips,  value_heads  >  value_tails)

(e)  Find the rows where both A and B are true.   Below is a demonstration on the  10 simulations:

>  ten_flips$A_and_B  <-  with(ten_flips,  A  &  B)

(f) Find the rows in which A u B is true.

ten_flips$A_or_B  <-  with(ten_flips,  A  |  B)

(g)  Find the proportion of the 10,000 coin flips in which A occurs, B occurs, A n B occurs and A u B occurs. Compare your results to the answers you derived in the first question of this problem set.