Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Carseats data that accompanies library(ISLR2) contains sales of child car seats at 400 different stores. To access the data, load the 'ISLR2' package and

The Carseats data that accompanies library(ISLR2) contains sales of child car seats at 400 different stores. To access the data, load the 'ISLR2' package and call the `Carseats` data as illustrated below.

library(ISLR2) data(Carseats)

Use simple random sampling to split the data into a train and test sample with 80% of the data in the train sample. Use a seed of 617. Compute the average price in the train sample and in the test sample. What is the absolute difference in average price between the train and test samples?

Now, use stratified sampling to split the "Carseats" data into a train and test sample with 80% of the data in the train sample. Do the sampling in such a way that the distribution of "price" is approximately equal in both samples. Use a seed of 617 and utilize "createDataPartition", for the split and set groups to 10. Compute the average price in the train sample and in the test sample. What is the absolute difference in average price between the train and test samples? Since you are asked absolute difference, if the difference is negative, drop the negative sign.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Engineering Mathematics

Authors: Erwin Kreyszig

10th edition

470458364, 470458365, 978-0470458365

More Books

Students also viewed these Mathematics questions

Question

Students graphed their completion of homework on a class report.

Answered: 1 week ago