logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Sabir AhmadFinance
(5/5)

587 Answers

Hire Me
expert
Anmol AroraGeneral article writing
(5/5)

795 Answers

Hire Me
expert
Yvonne DuffNursing
(5/5)

763 Answers

Hire Me
expert
Jessica FullerrPolitical science
(5/5)

984 Answers

Hire Me
R Programming
(5/5)

For this assignment, you must name your R file nycflights13.R For all questions you should load tidyverse and nycflights13.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

For this assignment, you must name your R file nycflights13.R For all questions you should load tidyverse and nycflights13. You should not need to use any other libraries. If the tidyverse package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this: install.packages("tidyverse") If the nycflights13 package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this: install.packages("nycflights13") If the openintro package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this: install.packages("openintro") If the lm.beta package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this: install.packages("lm.beta") Load tidyverse with: suppressPackageStartupMessages(library(tidyverse)) suppressPackageStartupMessages(library(openintro)) Load nycflights13 with: suppressPackageStartupMessages(library(nycflights13)) Load lm.beta with: suppressPackageStartupMessages(library(lm.beta)) NYCQs: Load nycflights13 with: suppressPackageStartupMessages(library(nycflights13)) The actual data set is called flights. msleepQs: The actual data set is called msleep PizzaQs: CSV file Round all float/dbl values to two decimal places. If your rounding does not work the way you expect, convert the tibble to a dataframe by using as.data.frame() All statistics should be run with variables in the order I state E.g., “Run a regression predicting mileage from mpg, make, and type” would be: lm(mileage ~ mpg + make + type...) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NYCQ1. For the month with the highest number of flights, what is that value? Hint: use head(1). This answer should be assigned to Q1. (expected output: 29425) NYCQ2: What five days of the year had the highest mean distance when leaving from JFK? Sort in descending order. The answer should be assigned to Q4 and appear like this: month day mean_distance 1 12 26 1342.40 2 12 23 1336.41 3 12 19 1335.62 4 12 30 1333.51 5 12 22 1332.73 NYCQ3: Address the outliers for departure delay as described in the outliers lectures, using 0.997 and 0.003 as the cutoffs. What percentage of data remains following the removal of these outliers? The answer should be assigned to Q3. (ANswer: 99.45) NYCQ4: Create a regression predicting departure delay from distance. The summary of the model should be assigned to Q4. You should not round. Expected Output: Multiple R-squared: 0.0006388, Adjusted R-squared: 0.0006357 F-statistic: 208.8 on 1 and 326677 DF, p-value: < 2.2e-16 NYCQ5: Create another regression, this time adding carrier to the regression from Q3. The summary of the model should be assigned to Q5. You should not round. Expected Output: Multiple R-squared: 0.015, Adjusted R-squared: 0.01495 F-statistic: 310.9 on 16 and 326662 DF, p-value: < 2.2e-16 msleepQ1: What is the variance in total sleep for carni vores and those whose conservation status is lc? Your answer should be in a 1 X 1 data frame with a value called ‘var’ with formatting like this: var 1 26.35 msleepQ2: What rodent (order Rodentia) has the highest total sleep/rem sleep ratio? Your answer should be in a 1 X 1 tibble assigned to Q2 with formatting like this: # A tibble: 1 × 1 name 1 Guinea pig msleepQ3: How many primates have a bodyweight/brainwt ratio greater than 100? answer:3 msleepQ4: Create two new variables, the mean of sleep total and variance of sleep total, grouped by conservation, and removing missing values. The names of the variables should correspond to those in the example below. The answer should be assigned to Q4: conservation mean_sleep var_sleep 1 cd 2.30 0.32 2 domesticated 7.58 14.46 3 en 13.03 39.45 4 lc 11.44 21.80 5 nt 12.97 3.84 6 vu 6.93 14.34 msleepQ5: Provide the name(s) of all the domesticated herbivores that sleep more than 12 hours. The answer should be assigned to Q5 Answer: # A tibble: 1 × 1 name 1 Chinchilla msleepQ6: Run cor.test for the relationship between total sleep and body weight. You should not round these values. The answer should be assigned to Q6 msleepQ7: Create a correlation matrix for the relations among total sleep, rem sleep, brain weight, and body weight. Make sure to remove missing values. The matrix should be assigned to Q7 msleepQ8: Run a regression predicting body weight by vore. Assign the coefficients to Q8 msleepQ9: Create a regression predicting bodywt by vore and REM sleep. Compared to the model in Q8, which one has the better AIC? Assign the better AIC value to Q9 msleepQ10: Create a logistic regression predicting whether or not an animal is a carnivore or herbivore based on sleep total. Assign the model to Q10. You’ll need to filter out omnivores and insectivores: filter(vore != "omni" & vore != "insecti") You will need to use the following code to create the variable you are predicting: mutate(vorebin = ifelse(vore == 'carni', 0, 1)) You should not round these values. PizzaQ1: Create a dataframe containing driver names of instances where free_wine = 1, discount_customer = 1, and the order contained more than 4 pizzas. (There will be repeated names). The answers should look like the following: 1 Salvatore 2 Salvatore 3 Salvatore 4 Salvatore 5 Mario 6 Mario 7 Salvatore 8 Luigi 9 Bruno PizzaQ2:Create a variable that is the ratio of bill to pizza, called ratio. What is the mean of that value (call the value mean_ratio)? Assign this to Q2 Answer: 17.27 Pizza Q3: For each day of the week, what is the variance in pizzas? The created values should be called var_pizzas. The answer should be assigned to Q3 and show look like the following: 1 Friday 2.10 2 Monday 1.94 3 Saturday 2.20 4 Sunday 2.09 5 Thursday 2.13 6 Tuesday 2.07 7 Wednesday 2.64 PizzaQ4: Which operator had the higher average bill? Answer: operator 1 Melissa PizzaQ5:What was the highest amount of free wine given by day/driver combination? (For instance, Friday Bruno was 13, while Wednesday Salvator was 12) The answer should be assigned to Q5 and look like the following: day driver n 1 Tuesday Bruno 20 PizzaQ6: Create a correlation matrix for temperature, bill, pizzas, and got_wine. Your matrix should be assigned to Q6. PizzaQ7: Create a correlation matrix of the relationships between time, temperature, bill, and pizzas for Laura in the East branch. Your matrix should be assigned to Q7. PizzaQ8: Run a regression predicting whether or not wine was ordered from temperature, bill, and pizza. Assign the coefficients of the summary of the model to Q8. PizzaQ9: Run a regression predicting bill from temperature, pizzas, and got_wine. Assign the standardized regression coefficients to Q9 by using the lm.beta() function. You should not round these values. PizzaQ10: Add operator to the regression from Q9. Which is the better model? Assign the better model’s AIC to Q10. Use the classical AIC (k=2). To access the fastfood data, run the following: fastfood <- openintro::fastfood FastfoodQ1: Looking only at Burger King and Chick-Fil-A, which item has the highest calories? The answer should be saved as Q1. FastfoodQ2: What is the mean sugar amount for all items from Subway? Save the value as Q2. FastfoodQ3: What is the mean value of calories for all items from Taco Bell? Save the value as

Q3. FastfoodQ4:Create a variable equal to total_fat x sugar called fatXsugar. Produce a tibble that has the restaurant, item, and fatXsugar for the top 3 items, from highest to lowest. Your answer should be in a 3 X 3 tibble called Q4 with formatting like this: # A tibble: 1 x 1 restaurant item fatXsugar 1 [name] [name] [value] 2 [name] [name] [value] 3 [name] [name] [value] FastFoodQ5: How many restaurants have an average saturated fat over 10? Your answer should be one integer stored in a variable called

Q5. FastFoodQ6: Create a correlation matrix for the relations between calories, total_fat, sugar, and calcium for all items at Sonic, Subway, and Taco Bell, omitting missing values with na.omit(). Assign the matrix to

Q6 FastFoodQ7: Create a regression predicting whether or not a restaurant is McDonalds or Subway based on calories, sodium, and protein. (McDonalds should be 1, Subway 0) Save the coefficients to

Q7 FastFoodQ8: Run the same regression as in #2 but remove sodium as a predictor. Which model fits better? Save the AIC of the better model to Q8. Use the classical AIC (k=2). FastFoodQ9: Run a regression predicting calories from saturated fat, fiber, and sugar. Based on standardized regression coefficients, identify the strongest predictor. Assign the unstandardized regression coefficient of the strongest predictor to

Q9. (You can access the coefficients by indexing the model object) FastFoodQ10: For this question, use data from only restaurants with between 50 and 60 items in the data set. Predict total fat from cholesterol, total carbs, vitamin a, and restaurant. Remove any nonsignificant predictors and run again. Assign the strongest standardized regression coefficient to Q10. Use the classical AIC (k=2).

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme