PSTAT 126 Regression and Python Analysis Project

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).
library(ISLR)
Auto
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
model.
(c). (2 pts) Indicate clearly how the coefficient estimates associated with the predictor origin should be
interpreted.
(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.
1
(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
(0, 1):
ez
p(z) =
.
(1)
1 + ez
(a). (4 pts) Show that indeed the inverse of a logistic function is the logit function:


p
z(p) = ln
.
1−p
(2)
(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 → −∞?
2

Don't use plagiarized sources. Get Your Custom Essay on
PSTAT 126 Regression and Python Analysis Project
Just from $13/Page
Order Essay
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

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.

Money-back guarantee

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

Zero-plagiarism guarantee

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

Free-revision policy

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

Privacy policy

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

Fair-cooperation guarantee

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
Live Chat+1(978) 822-0999EmailWhatsApp

Order your essay today and save 20% with the discount code LEMONADE