Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For questions requiring R code, provide screenshots of both the input ( code ) and the resulting output. Alternatively, directly copy and paste the R

For questions requiring R code, provide screenshots of both the input (code) and
the resulting output. Alternatively, directly copy and paste the R code along
with its output from the Console after executing the code.
The following questions are based on the Carseats dataset in R, which comprises sales data
for childrens car seats. This dataset is available in the ISLR package.
2.1 Load the ISLR package, import the Carseats dataset and assign it to the variable
data carseats. [2]
2.2 Run the data carseats dataset summary and get the descriptive statistics for each
variable in the dataset. [1]
2.3 Based on the summary output in question 2.2. One of the eleven variables of the
data carseats is ShelveLoc, which represents the quality of the shelving location for
car seats at each store.
2.3.1 What is the class of the variable ShelveLoc? [1]
2.3.2 How many stores have Bad shelf locations and how many stores have Medium shelf
locations? [2]
2.3.3 Write R code to count the frequency of each unique value in the ShelveLoc
variable and display it in a table format. [3]
2.3.4 Write R code to retrieve the counts for Good and Bad in the ShelveLoc variable
and save them in variables good count and bad count. [2]
2.3.5 Plot a bar graph of ShelveLoc to show the distribution of shelf locations (ShelveLoc)
in the data carseats and provide labels. [3]
2.3.6 Interpret the bar graph in question 2.3.5[3]
2
2.4 Apply the lm() function in R to fit a multiple regression model to predict Sales using
Price, Urban and US. Assign results to the variable carseats lm fit. [3]
2.5 Apply the summary() function to provide a summary of the multiple regression model
stored in carseats lm fit. [2]
2.6 Provide an interpretation of each coefficient in the carseats lm fit regression model. [7]
2.7 Write out the model in equation form specifying values to two places after the decimal
point. Hint: Be careful to handle the factor variables. [2]
2.8 For which of the predictors; can you reject the null hypothesis H0 : j =0?[2]
2.9 On the basis of your response to the previous question, use R to fit a smaller model that
only uses the predictors for which there is evidence of association with the outcome. [3]
2.10 How well do the models in (2.4) and (2.9) fit the data? [2]
2.11 Calculate 95% confidence intervals for the coefficient(s) derived from the model described
in question (2.9) and interpret the output. [3]
2.12 Does the model from (2.9) show indications of high leverage observations or outliers? [4]

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions