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：codinghelp
- Email：99515681@qq.com
- Work Time：8:00-23:00

- Rtos Kernel Assignmenthelp With ,Ghost... 2019-11-14
- Algorithm Course Assignmentghostwriter... 2019-11-14
- Help With Fpu Assignment,Ghostwriter P... 2019-11-14
- Ghostwriter Msc/Icy Course Assignment,... 2019-11-14
- Cse105 Assignmenthelp With ,Java Progr... 2019-11-14
- Ghostwriter Fm 9528 Assignment,Help Wi... 2019-11-14
- Cmt115 Assignmenthelp With ,Programmin... 2019-11-14
- Eng5298 Assignmenthelp With ,Ghostwrit... 2019-11-14
- Stat 432 Assignmentghostwriter ,R Prog... 2019-11-14
- Jit104 Assignmenthelp With ,Ghostwrite... 2019-11-13
- Help With Stat 3675Q Assignment,Ghostw... 2019-11-13
- Csc 360 Assignmentghostwriter ,Help Wi... 2019-11-13
- Ghostwriter Cpt120 Assignment,Ghostwri... 2019-11-13
- Comp9444 Assignmenthelp With ,Python P... 2019-11-13
- Help With Cs1026 Assignment,Analysis C... 2019-11-13
- Lp002 Assignmenthelp With ,Ghostwriter... 2019-11-13
- Ghostwriter Comp 250 Assignment,Help W... 2019-11-13
- Cmt107 Assignmenthelp With ,Ghostwrite... 2019-11-12
- Econometrics Assignmenthelp With ,Ghos... 2019-11-12
- Help With Dataset Course Assignment,Gh... 2019-11-12

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

© 2014 www.asgnhelp.com

Programming Assignment Help！