Disc3_Soln

pdf

School

University of Wisconsin, Madison *

*We aren’t endorsed by this school

Course

324

Subject

Mechanical Engineering

Date

Dec 6, 2023

Type

pdf

Pages

3

Uploaded by CoachFog15516

Report
Discussion 3 Solutions Warmup Discuss the Week 3 Quiz Question number 3 with the classmates around you. Relationship between two variables within a single group Exercise 1 Reconsider the engineering graduates data set in Engineering_Undergraduates_sample_1000.csv from discussion 2. It contains information on 1000 engineering graduates from two schools, Regional Technical Institute and the State Polytechnic. We will be concerned with whether a graduate graduated with honors (GPA>3.5) and which school they attended. Optionally run the code below to generate the contingency table relating school and high honors status (change eval=TRUE). #read in Engineering_Undergraduates_sample_1000.csv after saving .csv and .Rmd in same folder engineers = read.csv ( "Engineering_Undergraduates_sample_1000.csv" , header= TRUE ) #resave honors and school as categorical vectors in the engineers data frame. engineers $ honors = as.factor (engineers $ GPA > 3.5 ) engineers $ School = as.factor (engineers $ School) #This will rename the factor levels to be more descriptive levels (engineers $ honors) = c ( "no.honors" , "honors" ) #the table() function and R will make a contingency table for us from the two variables we care about addmargins ( table (engineers $ School, engineers $ honors)) no honors yes honors Total RTI 342 155 497 State Poly 294 209 503 Total 636 364 1000 a. If we were to choose one of the graduates at random from these 1000, what is the probability that the engineer graduated with honors? ANSWER: 364 1000 = 0 . 364 b. If we were to choose three engineers at random from these 1000 (without replacement), what is the probability that all three graduated with honors? ANSWER: 364 1000 363 999 362 998 = 0 . 04797561 Note: this computation is doing: P ( H 1 AND H 2 AND H 3) = P ( H 1) P ( H 2 | H 1) P ( H 3 | ( H 1 AND H 2)) where P(1st student honors)=364/1000 P(2nd student Honors | 1st student honors)=363/999 P(3rd student Honors | (1st student AND 2nd student honors)=362/998 1
364 * 363 * 362 / ( 1000 * 999 * 998 ) #=0.04797561 ## [1] 0.04797561 c. If we choose one of the engineers who graduated with honors at random to evaluate further, what is the probability that they attended RTI? ANSWER: P ( RTI | Honors ) = P ( RT IandHonors ) P ( Honors ) = 155 / 1000 364 / 1000 = 155 364 = 0 . 4258242 d. To what quantity should you compare the value from part (c) to see if there is a mathematical independence between honors and school in this group of 1000 observations? Do this comparison and draw a conclusion. Answer: If P ( RTI | Honors ) = P ( RTI ) , then the events RTI and Honors are independent in the set of data. The overall probability of having attended RTI in this group P ( RTI ) = 497 1000 = 0 . 497 is higher than the probability of having attended RTI among those engineers with honors. There is not an independence in this group of 1000 observations. Exercise 2 A hospital has three emergency generators for use in case of a power failure. Each generator operates independently and the manufacturer claims that the probability each generator will function properly during a power failure is 0.95. a. Complete the table below by calculating the probability that 0, 1, 2, or 3 of the emergency generators will fail during the next power outage. Solve using regular probability ideas since they will not have learned about binomial yet (help them think about P(x=0) means all 3 did not fail, so we would need to multiply 0.05 by itself 3 times). Etc. Number of Failures P(X=x) 0 1 ( . 05) 0 (0 . 95) 3 = 0 . 857375 1 3 ( . 05) 1 (0 . 95) 2 = 0 . 135375 2 3 ( . 05) 2 (0 . 95) 1 = 0 . 007125 3 1 ( . 05) 3 (0 . 95) 0 = 0 . 000125 b. Suppose a power failure occurs. What is the probability that at least one generator keeps working? P(at least one generator keeps working)=P(0, 1, or 2 fail)=1-P(3 fails)=1-0.000125=0.999875 c. Explain (briefly) how you can use the following simulation to check your answer for parts a and b. Some questions to consider: Why did I define WillFail as I did? What values are stored into the CountFailed vector? What does the histogram show? WillFail is a vector that is 5% 1’s and 95% 0s- since we had a 0.05 prob of failure and 0.95 prob of not failure failure. The variable samp is a sample of 3 generators (we observe either 0 or 1), so sum(samp) will have the values: 0, 1, 2, 3. The sum(samp) values get stored in CountFailed. Countfailed is a vector saving off how many of the 3 generators failed in each of the 100000 samples of size 3. So we can use the relative frequency of each value (0-3) to check prob. computed in a. Eg: 85695/100000= 0.85695 in 85695 of the 100000 samples of size 3, none (0) of the generators failed. WillFail = c ( rep ( 1 , 5 ), rep ( 0 , 95 )) manytimes = 100000 CountFailed = rep ( 0 ,manytimes) set.seed ( 1 ) for (i in 1 : manytimes){ 2
samp = sample (WillFail, 3 , replace= TRUE ) CountFailed[i] = sum (samp) } hist (CountFailed, labels= TRUE , ylim= c ( 0 ,. 95 * manytimes), breaks= seq ( - 0.5 , 3.5 , 1 )) Histogram of CountFailed CountFailed Frequency 0 1 2 3 0 20000 60000 85695 13617 679 9 #emperical check of part (b) sum (CountFailed < 3 ) / manytimes ## [1] 0.99991 1 - sum (CountFailed == 3 ) / manytimes ## [1] 0.99991 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help