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
icon
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 ) )
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 ) )
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education