Homework 4PSTAT 126, Winter 2022
Due date: March 11, 2022 at 23:59 PT
Note: Please show all the procedures of your analysis, and prepare the homework solution using RMarkdown.
All code should be well documented. A RMarkdown homework template is available on GauchoSpace.
Homework should be submitted on GauchoSpace.
You should write up your homework solution on your own. In particular, do not share your homework
RMarkdown file with other student.
Q1. This question uses the Auto dataset available in the ISLR package. The dataset under the name Auto is
automatically available once the ISLR package is loaded (as shown in the following code chunk).
The dataset Auto contains the following information for 392 vehicles:
mpg: miles per gallon
cylinders: number of cylinders (between 4 and 8)
displacement: engine displacement (cu.inches)
horsepower: engine horsepower
weight: vehicle weight (lbs)
acceleration: time to accelerate from 0 to 60 mph (seconds)
year: model year (modulo 100)
origin: origin of the vehicle (numerically coded as 1: American, 2: European, 3: Japanese)
name: vehicle name
Our goal is to analyze various linear models where mpg is the response variable.
(a). (2 pts) In this dataset, which predictors are qualitative, and which predictors are quantitative?
(b). (2 pts) Fit a MLR model to the data, in order to predict mpg using all of the other predictors except for
name. For each predictor in the fitted MLR model, comment on whether you can reject the null hypothesis
that there is no linear association between that predictor and mpg, conditional on the other predictors in the
(c). (2 pts) Indicate clearly how the coefficient estimates associated with the predictor origin should be
(d). (2 pts) What mpg do you predict for a Japanese car with three cylinders, displacement 100, horsepower
of 85, weight of 3000, acceleration of 20, built in the year 1980?
(e). (2 pts) On average, holding all other predictor variables fixed, what is the difference between the mpg of
a Japanese car and the mpg of an European car?
(f). (2 pts) Fit a model to predict mpg using origin and horsepower, as well as an interaction between origin
and horsepower. Present the summary output of the fitted model, and write out the fitted linear model.
(g). (2 pts) Following the previous question: On average, how much does the mpg of a Japanese car change
with a one-unit increase in horsepower?
(h). (2 pts) If we are fitting a polynomial regression with mpg as the response variable and weight as the
predictor, what should be a proper degree of that polynomial?
(i). (4 pts) Perform a backward selection, starting with the full model which includes all predictors except
for name. What is the best model based on the adjusted R2 criterion? What are the predictor variables in
that best model?
Q2. In a binary classification problem, let p represent the probability of class label “1”, which implies that
1 − p represents probability of class label “0”. The logistic function (also called the “inverse logit”) is the
cumulative distribution function of logistic distribution, which maps a real number z to the open interval
1 + ez
(a). (4 pts) Show that indeed the inverse of a logistic function is the logit function:
z(p) = ln
(b). Assume that z = β0 + β1 x1 , and p = logistic(z). (2 pts) How does the odds of the outcome change if you
increase x1 by two? (1 pts) Assume β1 is negative: what value does p approach as x1 → ∞? (1 pts) What
value does p approach as x1 → −∞?
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more