Question
Q4) Load the ISLR library and show the head of the Carseats data A) Report the following: dim(Carseats), summary statistics for each variable. (no need
Q4) Load the ISLR library and show the head of the Carseats data A) Report the following: dim(Carseats), summary statistics for each variable. (no need for graphs) B) Plot the x= ComPrice against the y=Population using ggplot (use smooth). What did you notice? C) Find confidence intervals (Standard and Percentile ones) for the average and for the median of both the Population and ComPrice using the bootstpping packages (R = 1000). Show your SE estimate from each package D) Plot your sampling distribution (bootstrap sampling distribution) for both the averages and medians. Q5) Use set.seed(9876543) to split your data into 70% training and 30% Testing A) Create a loop where you calculate the MSE from the training data for polynomials of degree 1 through 9 B) Create a loop where you calculate the MSE from the testing data for polynomials of degree 1 through 9 C) Plot the degree vs the MSEs from part A and B. Based on your plot, which polynomial degree is your best modeling ComPrice vs Population? D) Redo Q5 (A-C) using the Leave-One-Out Cross-Validation technique. (Use the whole data not the training from Q2 only)
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