Many college courses conclude by giving students the opportunity to evaluate the course and the instructor anonymously. However, the use of these student evaluations as an indicator of course quality and teaching effectiveness is often criticized because these measures may reflect the influence of non-teaching related characteristics, such as the physical appearance of the instructor. The article titled, “Beauty in the classroom: instructors’ pulchritude and putative pedagogical productivity” (Hamermesh and Parker, 2005) found that instructors who are viewed to be better looking receive higher instructional ratings. (Daniel S. Hamermesh, Amy Parker, Beauty in the classroom: instructors pulchritude and putative pedagogical productivity, *Economics of Education Review*, Volume 24, Issue 4, August 2005, Pages 369-376, ISSN 0272-7757, 10.1016/j.econedurev.2004.07.013. http://www.sciencedirect.com/science/article/pii/S0272775704001165.)

In this lab we will analyze the data from this study in order to learn what goes into a positive professor evaluation.

The data were gathered from end of semester student evaluations for a large sample of professors from the University of Texas at Austin. In addition, six students rated the professors’ physical appearance. (This is aslightly modified version of the original data set that was released as part of the replication data for *Data Analysis Using Regression and Multilevel/Hierarchical Models* (Gelman and Hill, 2007).) The result is a data frame where each row contains a different course and columns represent variables about the courses and professors.

`load("more/evals.RData")`

variable | description |
---|---|

`score` |
average professor evaluation score: (1) very unsatisfactory - (5) excellent. |

`rank` |
rank of professor: teaching, tenure track, tenured. |

`ethnicity` |
ethnicity of professor: not minority, minority. |

`gender` |
gender of professor: female, male. |

`language` |
language of school where professor received education: english or non-english. |

`age` |
age of professor. |

`cls_perc_eval` |
percent of students in class who completed evaluation. |

`cls_did_eval` |
number of students in class who completed evaluation. |

`cls_students` |
total number of students in class. |

`cls_level` |
class level: lower, upper. |

`cls_profs` |
number of professors teaching sections in course in sample: single, multiple. |

`cls_credits` |
number of credits of class: one credit (lab, PE, etc.), multi credit. |

`bty_f1lower` |
beauty rating of professor from lower level female: (1) lowest - (10) highest. |

`bty_f1upper` |
beauty rating of professor from upper level female: (1) lowest - (10) highest. |

`bty_f2upper` |
beauty rating of professor from second upper level female: (1) lowest - (10) highest. |

`bty_m1lower` |
beauty rating of professor from lower level male: (1) lowest - (10) highest. |

`bty_m1upper` |
beauty rating of professor from upper level male: (1) lowest - (10) highest. |

`bty_m2upper` |
beauty rating of professor from second upper level male: (1) lowest - (10) highest. |

`bty_avg` |
average beauty rating of professor. |

`pic_outfit` |
outfit of professor in picture: not formal, formal. |

`pic_color` |
color of professor’s picture: color, black & white. |

- Is this an observational study or an experiment? The original research question posed in the paper is whether beauty leads directly to the differences in course evaluations. Given the study design, is it possible to answer this question as it is phrased? If not, rephrase the question.

This is an observational study. We can rephrase the question as: Is there an association between beauty and course evaluation score?

- Describe the distribution of
`score`

. Is the distribution skewed? What does that tell you about how students rate courses? Is this what you expected to see? Why, or why not?

`summary(evals$score)`

```
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.300 3.800 4.300 4.175 4.600 5.000
```

`hist(evals$score)`

Left skewed. The distribution of score is between 2.3 and 5 with a median score of 4.3.

- Excluding
`score`

, select two other variables and describe their relationship using an appropriate visualization (scatterplot, side-by-side boxplots, or mosaic plot).

`plot(bty_avg ~ gender, data=evals)`

The fundamental phenomenon suggested by the study is that better looking teachers are evaluated more favorably. Let’s create a scatterplot to see if this appears to be the case:

`plot(evals$score ~ evals$bty_avg)`

Before we draw conclusions about the trend, compare the number of observations in the data frame with the approximate number of points on the scatterplot. Is anything awry?

- Replot the scatterplot, but this time use the function
`jitter()`

on the \(y\)- or the \(x\)-coordinate. (Use`?jitter`

to learn more.) What was misleading about the initial scatterplot?

*Initial scatterplot did not reveal any relationship between two variables score and bty_avg. It suggested relationship may not be linear. After adding jitter() function, scatterplots show some pattern with jitter() function added to score. However, it still does not reveal form and direction.*

```
par(mfrow = c(1, 2))
plot(evals$score ~ jitter(evals$bty_avg))
plot(jitter(evals$score) ~ evals$bty_avg)
```

- Let’s see if the apparent trend in the plot is something more than natural variation. Fit a linear model called
`m_bty`

to predict average professor score by average beauty rating and add the line to your plot using`abline(m_bty)`

. Write out the equation for the linear model and interpret the slope. Is average beauty score a statistically significant predictor? Does it appear to be a practically significant predictor?

```
options("scipen"=100, "digits"=4)
m_bty <- lm(evals$score ~ evals$bty_avg)
plot(evals$score ~ evals$bty_avg)
abline(m_bty)
```

`summary(m_bty)`

```
##
## Call:
## lm(formula = evals$score ~ evals$bty_avg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.925 -0.369 0.142 0.398 0.931
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.8803 0.0761 50.96 < 0.0000000000000002 ***
## evals$bty_avg 0.0666 0.0163 4.09 0.000051 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.535 on 461 degrees of freedom
## Multiple R-squared: 0.035, Adjusted R-squared: 0.0329
## F-statistic: 16.7 on 1 and 461 DF, p-value: 0.0000508
```

*Linear equation to predict average professor score(\(\hat{y}_{professor\ score}\)) by average beauty rating(\(x_{beauty\ rating}\)), with \(\beta_0 = 3.8803, \beta_1 = 0.0666\)*

*\(\hat{y}_{professor\ score} = \beta_0 + \beta_1{x}_{beauty\ rating}\)*

*\(\hat{y}_{professor\ score} = 3.8803 + 0.0666{x}_{beauty\ rating}\)*

*As \(\beta_0 = 3.88034\ and\ \beta_1 = 0.06664\) are positive, linear equation suggests there is positive relation between average professor score and average beauty rating. The equation also suggests as beauty rating increases, professor score will be increased by 0.06664. Also, as beauty rating approaches zero, professor score will be 3.88034. *

*As the p-value is 0.0000508, which is much less than 0.05, the model suggests there is a significant relationship between the variables in the linear regression model. Using \(R^2 = 0.035\), only 3.5 percent data can be explained by the model. Since it is low value, model is considered to be statistically significant predictor and not a practically significant predictor.*

- Use residual plots to evaluate whether the conditions of least squares regression are reasonable. Provide plots and comments for each one (see the Simple Regression Lab for a reminder of how to make these).

```
#Scatter residual plot
m_bty <- lm(evals$score ~ evals$bty_avg)
plot(m_bty$residuals ~ evals$bty_avg)
abline(h = 0, lty = 3)
```

```
#Residuals Histogram
hist(m_bty$residuals)
```

```
# Nearly normal residuals using Normal probability plot
qqnorm(m_bty$residuals)
qqline(m_bty$residuals) # adds diagonal line to the normal prob plot
```

*Looking at scatterplot, residuals are randomly scattered around zero on the horizontal axis. This indicates Linearity condition is met.*

*Histogram suggests data are left skewed. This indicates there are some outliers. Normal probability plot shows that most data points are close to the line. Both graphs show enough evidence that data meets Nearly Normal condition.*

*Looking at scatterplot, the points have constant variance, with the residuals scattered randomly around zero on the horizontal axis. Since residuals do not show increasing or decreasing pattern, we can assume Constant Variance exists.*

*Using residual plots we can conclude conditions for least squares regression are reasonable.*

The data set contains several variables on the beauty score of the professor: individual ratings from each of the six students who were asked to score the physical appearance of the professors and the average of these six scores. Let’s take a look at the relationship between one of these scores and the average beauty score.

```
plot(evals$bty_avg ~ evals$bty_f1lower)
cor(evals$bty_avg, evals$bty_f1lower)
```

As expected the relationship is quite strong - after all, the average score is calculated using the individual scores. We can actually take a look at the relationships between all beauty variables (columns 13 through 19) using the following command:

`plot(evals[,13:19])`

These variables are collinear (correlated), and adding more than one of these variables to the model would not add much value to the model. In this application and with these highly-correlated predictors, it is reasonable to use the average beauty score as the single representative of these variables.

In order to see if beauty is still a significant predictor of professor score after we’ve accounted for the gender of the professor, we can add the gender term into the model.

```
m_bty_gen <- lm(score ~ bty_avg + gender, data = evals)
summary(m_bty_gen)
```

- P-values and parameter estimates should only be trusted if the conditions for the regression are reasonable. Verify that the conditions for this model are reasonable using diagnostic plots.

*If data meets following conditions it is reasonable to apply regression model.*

**1_: The residuals of the model are nearly normal._**

**2_: The variability of the residuals is nearly constant._**

**3_: The residuals are independent._**

**4_: Each variable is linearly related to the outcome._**

```
#Scatter residual plot
m_bty_gen <- lm(score ~ bty_avg + gender, data = evals)
#Regression diagnostic plots
plot(m_bty_gen)
```

`hist(m_bty_gen$res)`

```
plot(evals$bty_avg, residuals(m_bty_gen), xlab="Beauty", ylab="Residuals", main = "Beauty Vs. Residuals")
abline(h=0, col="red")
```

`plot(evals$gender, residuals(m_bty_gen), xlab="Gender", ylab="Residuals", main = "Gender Vs. Residuals")`