Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Review the sample code for this week's module, as it demonstrates marginal, joint, and conditional probability using the diamonds sample dataset provided by ggplot2 (a
Review the sample code for this week's module, as it demonstrates marginal, joint, and conditional probability using the diamonds sample dataset provided by ggplot2 (a package from R's tidyverse). Open RStudio. Create a new project (File -> New Project). Select New Directory. Select New Project. Name the directory Assignment3. Change the project's path/subdirectory, if necessary. Click the Create Project button. Be sure to use the following to load the tidyverse: library (tidyverse) This assignment will use another sample dataset called mpg. This dataset contains fuel economy data for 38 models of cars (each of which had a new release) between 1999 and 2008. For more information, use help("mpg") in RStudio. After loading the tidyverse with the command above, enter mpg to display the first few rows of the data frame. mpg # A tibble: 234 x 11 manufacturer model displyear cyl trans dry cty hwy fl class audi a4 1. 8 1999 4 auto (15) 18 29 P compact 2 audi a4 1. 8 1999 4 manual (m5) 21 29 p compact 3 audi a4 2 2008 4 manual (m6) 20 31 p compact 4 audi a4 2 2008 auto (av) t t t t t tt 21 30 p compact 5 audi a4 2. 8 1999 6 auto (15) 16 26 p compact 6 audi a4 2. 8 1999 6 manual (m5) 18 26 p compact 7 audi a4 3.1 2008 6 auto(av) 18 27 p compact 8 audi a4 quattro 1.8 1999 4 manual (m5) 18 26 p compact 9 audi a4 quattro 1. 8 1999 auto (15) 16 25 p compact 10 audi a4 quattro 2008 4 manual (m6) 4 20 28 p compact # . . . with 224 more rows For each question below, it is advisable to make a new contingency table. 1. What is the probability that a vehicle in the dataset is 4-wheel drive? a. Hint: The drv (drive train) variable contains f (for front wheel drive), r (for rear wheel drive), and 4 (for four-wheel drive) 2. What is the probability that a vehicle in the dataset is a Nissan? 3. What is the probability that a vehicle in the dataset is a Dodge and a pickup? a. Hint: The class variable will contain pickup for any such vehicles. 4. What is the probability that a vehicle in the dataset is a Ford and a SUV? a. Hint: The class variable will contain suv for any such vehicles. 5. What is the probability that a vehicle in the dataset is a Jeep given that the vehicle had a 6- cylinder engine? Hint: The cyl variable will contain 6 for any such vehicles. Explain if you see any new relationships or associations that were not apparent in question 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started