wor4_sols

.docx

School

Queensland University of Technology *

*We aren’t endorsed by this school

Course

500

Subject

Statistics

Date

Apr 3, 2024

Type

docx

Pages

9

Uploaded by SuperHumanBoar4181

Workshop 4 Introduction to probability MXN500 Introduction About this workshop In this week’s workshop we will be exploring some basic probability rules. We will consider a couple of questions and use R to solve and produce effective diagrams. We assume you can get started in R with ease and that you’ve done the lecture and lab for this week and all previous weeks. Assumed skills Manipulating data objects in R Calculating and interpreting summary statistics Writing and executing functions in R Visualising results with ggplot2 Learning objectives Professional skills Visualising results A reminder of expectations in the workshop: Keep a record of the work being completed, both the R script and this document Allow everyone a chance to participate in the workshop All opinions are valued provided they do not harm others Everyone is expected to help out with completing the work, learning seldom occurs by watching someone else do maths Shuffle the group around so that someone different is controlling R Activity 1 – Bert and Ernie Two friends, Bert and Ernie, normally spend Saturday night out in the Valley. They regularly have an argument about the question of which club to go to just before 3am. Bert always wants to go to the “Electric Playground”. Ernie does not like to go to the same club every Saturday. For after 3am, he particularly likes both the “Electric Playground” and “Family”. On a given night, Ernie wants to go to the “Electric Playground”, but definitely not to “Family”, with probability 0.3. Ernie is fine with going to any of the two clubs with
probability 0.2. He is okay with going to “Family” with probability 0.6. On all other Saturday nights, Ernie is too drunk to go anywhere at 3am. Write all relevant events using proper set notation and answer the following questions. Exercise: Define all relevant events. Answer: Let E be the event that Ernie wants to (and is able to) go to the Electric Playground. Let F be the event that Ernie wants to (and is able to) go to the Family. P ( E F )= 0.3 P ( EF )= 0.2 P ( F )= 0.6 Exercise: Modify the following code to plot a Venn diagram of Ernie’s club preference. library (VennDiagram) draw.pairwise.venn ( area1 = ..., area2 = ..., cross.area = ..., category = c ( "Electric Playground" , "Family" ), lty = rep ( "blank" , 2 ), fill = c ( "light blue" , "pink" ), alpha = rep ( 0.5 , 2 ), cat.pos = c ( 0 , 0 ), cat.dist = rep ( 0.025 , 2 ), scaled = F) Answer: library (VennDiagram) draw.pairwise.venn ( area1 = 0.5 , area2 = 0.6 , cross.area = 0.2 , category = c ( "Electric Playground" , "Family" ), lty = rep ( "blank" , 2 ), fill = c ( "light blue" , "pink" ), alpha = rep ( 0.5 , 2 ), cat.pos = c ( 0 , 0 ), cat.dist = rep ( 0.025 , 2 ), scaled = F) Exercise: What is the probability that, on a given night, Bert and Ernie happen to have an argument because Ernie wants to go to “Family” and not to the “Electric Playground”?
Answer: P ( E F )= P ( F )− P ( EF ) law of total probability ¿ 0.6 0.2 ¿ 0.4 Exercise: What is the probability that, on a given night, Bert and Ernie happen to have no argument because they happily go to the Electric Playground? Answer: P ( E )= P ( EF )+ P ( E F ) ¿ 0.2 + 0.3 ¿ 0.5 Exercise: What is the probability that, on a given night, Ernie is too drunk to get into any club at 3am? Answer: P ( E F )= 1 P ( E F ) complement ¿ 1 −( P ( E )+ P ( F )− P ( EF )) addition rule for non-disjoint events ¿ 1 −( 0.5 + 0.6 0.2 ) ¿ 1 0.9 ¿ 0.1 Exercise: What is the probability that, on a given night, Ernie does not want to or is not able to go to the Electric Playground? Answer: P ( E )= 1 P ( E ) complement rule ¿ 1 0.5 ¿ 0.5 Activity 2 – VIP Pass The company that owns WB Movie World, Sea World and Wet’n’Wild offers a “VIP Pass” for 99 dollars that gives you unlimited entry into all 3 theme parks for 1 year. Now the company is considering offering this “VIP Pass” for another year. However, managers are worried that there might be too many people who pay only once for the “VIP Pass” while going to the theme parks very often. They decide that they will not offer the “VIP Pass” for
another year if the probability that a customer with a “VIP Pass” goes to the parks more than 5 times is greater than 0.35. From the data of the current year they know that the probability is 0.5 that a customer buying the “VIP Pass” is 18 years or younger, the probability is 0.4 that a customer with a “VIP Pass” is between 19 and 40 years of age, and the probability is 0.1 that a customer with a “VIP Pass” is 41 years or older. They also know that the probability is 0.4, 0.3 and 0.2 that a “VIP Pass” customer of age 18 , age 18 40 and age 41 , respectively, goes to the parks more than 5 times during the year. Exercise: Define all relevant events. Answer: Let Y be the event that a VIP pass customer is in the youngest age range. Let M be the event that a VIP pass customer is in the middle age range. Let O be the event that a VIP pass customer is in the oldest age range. Let F be the event that a VIP pass customer uses the pass more than five times in a year. P ( Y )= 0.5 P ( M )= 0.4 P ( O )= 0.1 P ( F Y )= 0.4 P ( F M )= 0.3 P ( F O )= 0.2 Exercise: Modify the following code to create a visualisation of the scenario. library (DiagrammeR) nodes <- create_node_df ( n = 10 , type = "number" , label = c ( "" , "<=18" , "19-40" , ">=41" , "<=5" , ">5" , "<=5" , ">5" , "<=5" , ">5" )) edges <- create_edge_df ( from = c ( 1 , 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 ), to = c ( 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ), label = c (...), rel = "leading to" ) graph <- create_graph ( nodes_df = nodes, edges_df = edges, attr_theme= NULL ) # View the graph render_graph (graph)
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