This is the problem I’m struggling with-

According to New Jersey Transit, the 8:00 am weekday train from Princeton to New York City has a 90% chance of arriving on time. To test this claim, an auditor chooses 6 weekdays at random during a month to ride this train. The train arrives late on 2 of those days. Does the auditor have convincing evidence that the company’s claim isn’t true? Design and carry out a simulation using Table D (start at line 101) to estimate the probability that a train with a 90% chance of arriving on time each day would be late 2 or more of 6 days. Follow the four-step process.

Here is what I have tried but my teacher I have emailed has let me know it’s not correct. I don’t understand how to set it all up right.

State the question of interest using the language of probability.

Solution:

What is the probability that, in a sample of six weekdays at random out of a month for a train that arrives on time 90% of the time, the train is late on two of these six days?

(b) (5 pts.) How would you use random digits to imitate one simulation of the process? Are you going to use a random sampling with or without replacement? Explain!

Solution:

Let the numbers 1-5.4 represent on time days and 5.5-6 represent late days. We will use random sampling with replacement because each of these numbers represents a day in the month. Sampling without replacement would greatly change the proportion of on time days in this simulation.

(c) (5 pts.) What variable would you measure in one simulation?

Solution:

We will counts the numbers 28-30. (late days)

(d) (10 pts.) Use R to carry out one such simulation that you described in (b) and (c) by creating a sequence of numbers. Paste your commands together with the corresponding output. (Use your student ID to seed R)

Solution:

> pop = seq(1,100)

> pop

[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

[19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

[37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

[55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

[73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

[91] 91 92 93 94 95 96 97 98 99 100

(e) (20 pts.) Perform 1000 repetitions of the simulation. What conclusion would you draw? Paste your code from the R Editor. Also, paste your result from the R Console.

Solution:

Code:

pop = seq(1,100)

total = c()

for(i in 1:1000){

samp = sample(pop,6, replace=T)

vectorTF = samp<=6

countCB = sum(vectorTF)

total = c(total,countCB)

}

sum(total == 2)/length(total)

Result:

> pop = seq(1,100)

> total = c()

>

> for(i in 1:1000){

+ samp = sample(pop,6, replace=T)

+ vectorTF = samp<=6

+

+ countCB = sum(vectorTF)

+

+ total = c(total,countCB)

+ }

>

> sum(total == 2)/length(total)

[1] 0.043

(f) (+ 5 pts. Extra Credit) Find the theoretical probability that the train will be late on 2 out of 6 randomly selected days.

Solution:

Let A=event that a day where train is on time is selected.

Let L=event that a day where train is late is selected.

A=.90

L=.10

Let us determine first how many outcomes are there where we can have two late train days in a random sample of 6:LLAAAA, LALAAA,LAALAA,LAAALA, LAAAAL,ALAAAL, so we have 6 such outcomes of interest.

Therefore, P(two late days) =P(LLAAAA or LALAAA or LAALAA or LAAALA, LAAAAL or ALAAAL

=P((LLAAAA)+P(LALAAA)+P(LAALAA)+P(LAAAAL)+P( ALAAAL)

=P(L)P(L)P(A)P(A)P(A)P(A)+P(L)P(A)P(L)P(A)P(A)+P(L )P(A)P(A)P(L)P(A)P(A)+P(L)P(A)P(A)P(A)P(A)P(L)+P(A )P(A)P(A)P(A)P(L)

=(.10)^2(.90)*6=0.007553552

In “R”:

> .10^2.90*6

[1] 0.007553552

## Bookmarks