Fast Food Analysis For the purposes of Questions 10 to 19, we are interested in trying to predict the number of calories in fastfood items, given other information about their nutritional content. You will need to open Rstudio, and then write and run some code, in order to answer these questions. You should attach the .r file used to answer these questions to your submission. Whilst not directly used for assessment, it may be used as evidence in the case of a marking dispute, as well as evidence of plagiarism should it be necessary. Before you start, you will need to install the openintro library via install.packages ("openintro") Then, load library openintro and look at the help file for fastfood. library ("openintro") ?fastfood Please let me know (by email) sooner rather than later if you have technical issues installing the package and loading the
Fast Food Analysis For the purposes of Questions 10 to 19, we are interested in trying to predict the number of calories in fastfood items, given other information about their nutritional content. You will need to open Rstudio, and then write and run some code, in order to answer these questions. You should attach the .r file used to answer these questions to your submission. Whilst not directly used for assessment, it may be used as evidence in the case of a marking dispute, as well as evidence of plagiarism should it be necessary. Before you start, you will need to install the openintro library via install.packages ("openintro") Then, load library openintro and look at the help file for fastfood. library ("openintro") ?fastfood Please let me know (by email) sooner rather than later if you have technical issues installing the package and loading the
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Fast Food Analysis
For the purposes of Questions 10 to 19, we are interested in trying to predict the number of calories in fastfood items, given other
information about their nutritional content. You will need to open Rstudio, and then write and run some code, in order to answer these
questions. You should attach the .r file used to answer these questions to your submission. Whilst not directly used for assessment, it may
be used as evidence in the case of a marking dispute, as well as evidence of plagiarism should it be necessary.
Before you start, you will need to install the openintro library via
install.packages ("openintro")
Then, load library openintro and look at the help file for fastfood.
library ("openintro")
?fastfood
Please let me know (by email) sooner rather than later if you have technical issues installing the package and loading the
data.
Now, we are going to be interested in a subset of this data. Start by generating a new dataframe ffood that you are to use throughout
these questions as follows:
fries <- fastfood [,-c (1, 2,4,7,17)]
burger <- which ( rowSums ( is.na ( fries ) ) > 0 )
ffood <- fries [-burger, ]
sum ( is.na ( ffood ) )](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc51fd93d-a69a-456a-b129-c1a35d94012d%2Faf788fdf-9ae3-459c-b0c8-e88dc56ed0b8%2F1qb64wg_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Fast Food Analysis
For the purposes of Questions 10 to 19, we are interested in trying to predict the number of calories in fastfood items, given other
information about their nutritional content. You will need to open Rstudio, and then write and run some code, in order to answer these
questions. You should attach the .r file used to answer these questions to your submission. Whilst not directly used for assessment, it may
be used as evidence in the case of a marking dispute, as well as evidence of plagiarism should it be necessary.
Before you start, you will need to install the openintro library via
install.packages ("openintro")
Then, load library openintro and look at the help file for fastfood.
library ("openintro")
?fastfood
Please let me know (by email) sooner rather than later if you have technical issues installing the package and loading the
data.
Now, we are going to be interested in a subset of this data. Start by generating a new dataframe ffood that you are to use throughout
these questions as follows:
fries <- fastfood [,-c (1, 2,4,7,17)]
burger <- which ( rowSums ( is.na ( fries ) ) > 0 )
ffood <- fries [-burger, ]
sum ( is.na ( ffood ) )

Transcribed Image Text:Question 16
Use 200 replications of data-splitting with 230 samples for training to compare the predictive performance of the following models
with the remaining possible predictors for calories.
- Best subset selection (BSS) with BIC (you may use the predict.regsubsets function introduced in the practical demonstration
by copying the code and pasting into your R script).
- Ridge with min-CV lambda (use 5 or 10 folds).
- PCR with min-CV number of principal components.
Display the results in the form of boxplots. Using this plot, or otherwise, select which of the following options represents the median
CV predictive performance (in terms of test correlation) ranking from highest to lowest.
At the start of your code for this question, it is recommended that you set the random seed to 3 using
set.seed (3)
for reproducibility purposes.
BSS, ridge, PCR
(B) ridge, BSS, PCR
C) PCR, ridge, BSS
D PCR, BSS, ridge
E BSS, PCR, ridge
F) ridge, PCR, BSS
Question 17
Following on from Question 16, re-run your code (including setting the seed), this time storing the number of variables chosen for
each of the 200 replications of Best Subset Selection, and display the results in a histogram. How many predictors does a model
chosen by Best Subset Selection favour most frequently?
Add your answer
Question 18
Following on from Questions 16 and 17, re-run your code (including setting the seed), this time storing the number of principal
components chosen for each of the 200 replications of PCR. What is the mean number of principal components chosen across
these 200 replications?
Add your answer
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education