Home Page > > Details

Please do not share this handout outside the class.

STAT 3032 Homework4 Instruction (Fall 2019)

Due Thursday, Oct 17 @ 11:59pm in Canvas

20 points in total

Please show your work on each problem for full credit. A correct answer, unsupported by the

necessary explanation, R code or output will receive very little if any credit. Your work needs

to be organized in a reasonably neat and coherent way, and submitted as a pdf file on

Canvas.

You are welcome to discuss with your classmates, but you must write up your homework

individually!

Problem 1

This problem will use the RateMyProfeesor dataset we saw in the lectures! Download the data

file RateprofThree.csv from Canvas. Each observation is a professor. The variables are:

quality the quality score of the professor on a scale of 1 to 5, with 1 being the worst and

5 being the best.

gender the gender of the professor. The possible values are “female” and “male”.

pepper if the professor is considered “hot” (i.e. physically attractive). The possible values

are “yes” and “no”.

(a) Import the dataset into R. Among the professors in the sample, how many of them are

male? How many professors received “yes” for their pepper value? Hint: use

summary(dataName)

(b) Fit a model that uses pepper to predict quality. Provide the model summary. What

percentage of the variability in quality is explained by pepper?

Note: You may notice that the percentage is low. We are using Problem 2 to practice

using dummy variable, not to find a good model to predict quality.

(c) What is the base level of pepper (the level that corresponds to 0 in the dummy

variable)?

Please do not share this handout outside the class.

(d) Interpret the estimated slope of the model in Part (b) in the context.

(e) Interpret the estimated intercept of the model in Part (b) in the context.

(f) Now fit a model using both gender and pepper to predict quality. Provide the

summary of the model. Write down the fitted model. Please pay attention to the notation.

(g) What is the average of the quality score for male professors with pepper equal to “no”?

Hint: For these professors, what is the value of pepperyes? What is the value of

gendermale?

(h) Please order the following four groups according to their average quality score (from the

highest to the lowest).

-Group A: male professors with pepper equal to “yes”

-Group B: female professors with pepper equal to “yes”

-Group C: male professors with pepper equal to “no”

-Group D: female professors with pepper equal to “no”

Problem 2

This problem is adapted from Question 1 in Section 3.4 (pg. 103) in the textbook A Modern

Approach to Regression with R.

The data file airfares.txt on the book web site gives the one-way airfare (in US dollars)

and distance (in miles) from city A to 17 other cities in the US. Interest centers on modeling

airfare as a function of distance.

Please do not share this handout outside the class.

(a) Read in the dataset from a website (see url below) and fit the model that uses

Distance to predict Fare.Provide the summary of your model output.

The url for the data is: http://gattonweb.uky.edu/sheather/book/docs/datasets/airfares.txt

Hint: Use the R function read.table( )

(b) Create a scatterplot of Fare (y-axis) vs. Distance (x-axis) with the fitted regression

model. Color this fitted model red. Hint: Use the R functions plot(y~x, data =

dataName) and abline(modelName, col = ‘red’)

(c) Create a plot where the x-axis is Distance and the y-axis is the standardized residuals

from the model. Include two horizontal lines at -2 and 2 to mark the boundaries of

outliers. Hint: use the R functions rstandard(modName) ,

plot(rstandard(modName)~ dataName$x), and abline(h=2).

(d) Remove the two outliers found in Part (c) in the dataset. Note that one of the outliers has

a standardized residual just below -2. In real life, it is up to you to determine if you want

to remove this borderline case. Here, we will remove it. Fit a polynomial regression

model of order 2. Provide the output of your fitted model.

(e) Write down the fitted model equation from Part (d). Pay attention to the notation.

(f) If we conduct the test of H vs. , where is the slope of . 0

: β2 = 0 HA

: β2 =/ 0 β2 Distance

What is the test statistic value based on this sample? What distribution does the test

statistic follow under the null hypothesis? What is the p value?

Contact Us(Ghostwriter Service)

- QQ：99515681
- WeChat：codinghelp2
- Email：99515681@qq.com
- Work Time：8:00-23:00

- Ghostwriter Math223 Assignment,R Cours... 2020-05-28
- Ghostwriter Kxo151 Assignment,Help Wit... 2020-05-28
- Math 160 Assignmenthelp With ,Data Cou... 2020-05-28
- Help With Csci 3120 Assignment,Program... 2020-05-28
- St2020 Course Assignmenthelp With ,Sta... 2020-05-28
- Com1005 Assignmentghostwriter ,Ai Tech... 2020-05-28
- Ghostwriter Sit216 Assignment,Python P... 2020-05-28
- Ghostwriter Artificial Course Assignme... 2020-05-27
- Comp Sci 3306 Assignmentghostwriter ,P... 2020-05-27
- Data Assignmentghostwriter ,Help With ... 2020-05-27
- Csci 3120 Assignmenthelp With ,C++ Pro... 2020-05-26
- Ghostwriter Algorithms Assignment,Data... 2020-05-26
- Data Science Assignmentghostwriter ,C+... 2020-05-26
- Data Course Assignmentghostwriter ,C++... 2020-05-26
- Ghostwriter R Assignment,Help With Dat... 2020-05-25
- Cosc473 Assignmenthelp With ,Systems A... 2020-05-25
- Data Assignmenthelp With ,R Programmin... 2020-05-25
- Comp 250 Assignment 3 2020-05-24
- Macm 316 – Computing Assignment 7 2020-05-24
- Sta457 Assignment 2020-05-24

Contact Us - Email：99515681@qq.com WeChat：codinghelp2

© 2014 www.asgnhelp.com

Programming Assignment Help！