The Data

download.file("http://www.openintro.org/stat/data/evals.RData", destfile = "evals.RData")
load("evals.RData")

Exercise 1: 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 observatonal study because the conditions of the study were not manipulated in any way. Rather, the results of a survey were collcted and observed. Thus, it is not possible or advisale to answer the question as posed. It would be better to ask whether beauty is associated with differences in course evaluations.

Exercise 2: 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?

hist(evals$score)

# Yes, the distribution is left-skewed due to the long tail on the left of the distribution. This implies that students tend to give higher ratings on average. I'm not surprised by this because, based on my experience, most students would rather give their professors the highest score possible than an honest evluation simply because they don't want to spend or devote anymore time to a class.

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

boxplot(evals$bty_f1upper~evals$ethnicity)

# It appears that professors that were not minoritis were considered to less attractive on average by females in upper level classes. The IQR was much larger for non-minorities, as evidenced by the spread between the middle 50% of the data from nearly 3 to 7 compared to that of minorities from 5 to 7. The minimum for non-minorities is also lower than that of minorities at about 0 compared to 2. The plots are similar from the 75% percentile and above. 

Simple Linear Regression

plot(evals$score ~ evals$bty_avg)

evals$score
##   [1] 4.7 4.1 3.9 4.8 4.6 4.3 2.8 4.1 3.4 4.5 3.8 4.5 4.6 3.9 3.9 4.3 4.5 4.8
##  [19] 4.6 4.6 4.9 4.6 4.5 4.4 4.6 4.7 4.5 4.8 4.9 4.5 4.4 4.3 4.1 4.2 3.5 3.4
##  [37] 4.5 4.4 4.4 2.5 4.3 4.5 4.8 4.8 4.4 4.7 4.4 4.7 4.5 4.0 4.3 4.4 4.5 5.0
##  [55] 4.9 4.6 5.0 4.7 5.0 3.6 3.7 4.3 4.1 4.2 4.7 4.7 3.5 4.1 4.2 4.0 4.0 3.9
##  [73] 4.4 3.8 3.5 4.2 3.5 3.6 2.9 3.3 3.3 3.2 4.6 4.2 4.3 4.4 4.1 4.6 4.4 4.8
##  [91] 4.3 3.6 4.3 4.0 4.2 4.1 4.1 4.4 4.3 4.4 4.4 4.9 5.0 4.4 4.8 4.9 4.3 5.0
## [109] 4.7 4.5 3.5 3.9 4.0 4.0 3.7 3.4 3.3 3.8 3.9 3.4 3.7 4.1 3.7 3.5 3.5 4.4
## [127] 3.4 4.3 3.7 4.7 3.9 3.6 4.5 4.5 4.8 4.8 4.7 4.5 4.3 4.8 4.1 4.4 4.3 3.6
## [145] 4.5 4.3 4.4 4.7 4.8 3.5 3.8 3.6 4.2 3.6 4.4 3.7 4.3 4.6 4.6 4.1 3.6 2.3
## [163] 4.3 4.4 3.6 4.4 3.9 3.8 3.4 4.9 4.1 3.2 4.2 3.9 4.9 4.7 4.4 4.2 4.0 4.4
## [181] 3.9 4.4 3.0 3.5 2.8 4.6 4.3 3.4 3.0 4.2 4.3 4.1 4.6 3.9 3.5 4.0 4.0 3.9
## [199] 3.3 4.0 3.8 4.2 4.0 3.8 3.3 4.1 4.7 4.4 4.8 4.8 4.6 4.6 4.8 4.4 4.7 4.7
## [217] 3.3 4.4 4.3 4.9 4.4 4.7 4.3 4.8 4.5 4.7 3.3 4.7 4.6 3.6 4.0 4.1 4.0 4.5
## [235] 4.6 4.8 4.6 4.9 3.1 3.7 3.7 3.9 3.9 3.2 4.4 4.2 4.7 3.9 3.6 3.4 4.4 4.4
## [253] 4.1 3.6 3.5 4.1 3.8 4.0 4.8 4.2 4.6 4.3 4.8 3.8 4.5 4.9 4.9 4.8 4.7 4.6
## [271] 4.3 4.4 4.5 4.2 4.8 4.6 4.9 4.8 4.8 4.6 4.7 4.1 3.8 4.0 4.1 4.0 4.1 3.5
## [289] 4.1 3.6 4.0 3.9 3.8 4.4 4.7 3.8 4.1 4.1 4.7 4.3 4.4 4.5 3.1 3.7 4.5 3.0
## [307] 4.6 3.7 3.6 3.2 3.3 2.9 4.2 4.5 3.8 3.7 3.7 4.0 3.7 4.5 3.8 3.9 4.6 4.5
## [325] 4.2 4.0 3.8 3.5 2.7 4.0 4.6 3.9 4.5 3.7 2.4 3.1 2.5 3.0 4.5 4.8 4.9 4.5
## [343] 4.6 4.5 4.9 4.4 4.6 4.6 5.0 4.9 4.6 4.8 4.9 4.9 4.9 5.0 4.5 3.5 3.8 3.9
## [361] 3.9 4.2 4.1 4.8 4.8 4.8 4.8 4.9 4.2 4.5 3.9 4.4 4.0 3.6 3.7 2.7 4.5 4.4
## [379] 3.9 3.6 4.4 4.4 4.7 4.5 4.1 3.7 4.3 3.5 3.7 4.0 4.0 3.1 4.5 4.8 4.2 4.9
## [397] 4.8 3.5 3.6 4.4 3.4 3.9 3.8 4.8 4.6 5.0 3.8 4.2 3.3 4.7 4.6 4.6 4.0 4.2
## [415] 4.9 4.5 4.8 3.8 4.8 5.0 5.0 4.9 4.6 5.0 4.8 4.9 4.9 3.9 3.9 4.5 4.5 3.3
## [433] 3.1 2.8 3.1 4.2 3.4 3.0 3.3 3.6 3.7 3.6 4.3 4.1 4.9 4.8 3.7 3.9 4.5 3.6
## [451] 4.4 3.4 4.4 4.5 4.5 4.5 4.6 4.1 4.5 3.5 4.4 4.4 4.1
evals$bty_avg
##   [1] 5.000 5.000 5.000 5.000 3.000 3.000 3.000 3.333 3.333 3.167 3.167 3.167
##  [13] 3.167 3.167 3.167 3.167 3.167 7.333 7.333 7.333 7.333 7.333 7.333 5.500
##  [25] 5.500 5.500 5.500 5.500 5.500 5.500 4.167 4.167 4.167 4.167 4.167 4.000
##  [37] 4.000 4.000 4.000 4.000 4.000 4.000 4.667 4.667 4.667 4.667 4.667 4.667
##  [49] 4.667 5.500 5.500 5.500 5.500 5.500 5.500 5.500 5.500 5.500 5.500 4.833
##  [61] 4.833 4.833 4.333 4.333 4.333 4.333 4.333 4.833 4.833 4.833 4.833 4.833
##  [73] 4.833 4.833 4.000 4.000 4.000 4.000 5.500 5.500 5.500 5.500 4.167 4.167
##  [85] 4.167 4.167 4.167 4.167 2.500 2.500 2.500 2.500 2.500 4.333 4.333 4.333
##  [97] 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333
## [109] 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333
## [121] 4.833 4.833 4.833 4.833 4.833 4.833 2.833 3.000 3.000 3.000 3.000 3.000
## [133] 4.167 4.167 4.167 4.167 4.167 4.167 4.167 7.833 7.833 3.833 3.833 3.833
## [145] 3.833 3.833 4.833 4.833 4.833 4.833 4.833 4.833 4.833 3.000 3.000 3.000
## [157] 3.000 3.000 3.000 3.000 3.000 5.167 4.333 4.333 4.333 4.333 4.333 4.333
## [169] 4.333 2.667 2.667 2.667 5.500 5.500 5.500 5.500 5.500 4.333 4.333 4.333
## [181] 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 4.333 2.333 2.333
## [193] 2.333 6.500 6.500 6.500 6.500 2.333 2.333 2.333 2.333 2.333 2.333 2.333
## [205] 2.333 3.000 3.000 3.000 3.667 3.667 3.667 3.667 3.667 3.667 3.667 3.667
## [217] 6.167 4.000 4.000 4.000 4.000 4.000 4.833 4.833 4.833 4.833 8.167 8.167
## [229] 8.167 8.167 6.500 6.500 6.500 4.833 4.833 4.833 4.833 7.000 7.000 7.000
## [241] 4.667 3.833 3.833 3.833 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167
## [253] 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167 3.167
## [265] 5.833 5.833 5.833 5.833 5.833 5.833 5.667 5.667 5.667 5.667 6.500 6.500
## [277] 6.500 6.500 6.500 6.500 6.500 1.667 1.667 1.667 1.667 1.667 1.667 6.667
## [289] 6.667 6.667 3.667 3.667 3.667 3.833 3.833 6.167 6.167 3.333 3.333 3.333
## [301] 3.333 3.333 3.333 3.333 3.333 3.333 3.333 3.667 3.667 3.500 3.500 3.500
## [313] 2.667 5.667 6.000 6.000 6.500 6.500 6.500 2.333 2.333 2.333 2.333 2.333
## [325] 2.333 2.333 2.333 2.333 2.333 2.333 2.333 2.333 7.167 7.167 1.667 1.667
## [337] 1.667 5.167 3.500 3.500 3.500 3.500 3.500 3.500 3.500 3.500 3.500 3.333
## [349] 3.333 3.333 3.333 3.333 3.333 3.333 3.333 3.333 3.333 5.833 5.833 5.833
## [361] 5.833 5.833 5.833 6.167 6.167 6.167 6.167 6.167 3.333 3.333 3.333 3.333
## [373] 5.167 5.167 4.167 4.167 2.500 2.500 2.500 2.500 2.500 2.500 4.333 4.333
## [385] 4.333 4.333 3.000 3.000 3.000 6.333 6.333 6.333 6.333 3.333 3.333 3.333
## [397] 3.333 2.833 2.833 2.833 2.833 2.833 2.833 2.833 2.833 2.833 2.833 2.833
## [409] 6.667 6.667 6.667 6.667 6.667 6.833 6.833 6.833 6.833 6.833 7.833 7.833
## [421] 7.833 7.833 7.833 7.833 7.833 7.833 7.833 7.833 7.833 5.833 5.833 2.000
## [433] 2.000 2.000 2.000 2.000 2.000 2.000 7.833 7.833 7.833 3.333 3.333 4.500
## [445] 4.500 4.500 4.333 4.333 4.333 4.333 4.333 4.333 4.333 6.833 6.833 6.833
## [457] 6.833 6.833 6.833 5.333 5.333 5.333 5.333

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?

Yes, while there are 463 observations in the dataset, only a third or so of them are plotted in the scatterplot.

Exercise 4: 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?

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

# The initial scatterplot did not include ties whereas jitter modifies observations values slightly to break ties so that all the observations in a dataset are plotted.

Exercise 5: 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?

m_bty <-lm(jitter(evals$score) ~ evals$bty_avg)
plot(jitter(evals$score)~evals$bty_avg)
abline(m_bty)

summary(m_bty)
## 
## Call:
## lm(formula = jitter(evals$score) ~ evals$bty_avg)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9193 -0.3565  0.1399  0.4068  0.9227 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3.88061    0.07627  50.881  < 2e-16 ***
## evals$bty_avg  0.06644    0.01632   4.072  5.5e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5357 on 461 degrees of freedom
## Multiple R-squared:  0.03471,    Adjusted R-squared:  0.03262 
## F-statistic: 16.58 on 1 and 461 DF,  p-value: 5.496e-05
# The equation for the linear model is y = 3.880 _0.66x. While average beauty score is a statistically significant predictor of the evaluation score of a teacher since the P-value is extremely low, it is not a practically signifiant predictor at all. This can be inferred by the equally low R squared value of 0.035. 

Exercise 6: 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).

plot(m_bty)

# The conditions of least squares regression are reasonable in this case. From the plot of the residuals as a function of the fitted values of the linear model, it can be seen that the residuals do not exhibit any pattern, meaning the distance of the values from the least squares line of best fit is fairly constant. Similarly, the scale-location plot shows equal variance or homoskedacity. Additionally, the qq plot of the residuals is normal although skewed to the right somewhat. Overall, the residual plots seems to indicate that a linear model is a good fit despite the R sqaured value suggesting otherwise.

Multiple Linear Regression

plot(evals$bty_avg ~ evals$bty_f1lower)

cor(evals$bty_avg, evals$bty_f1lower)
## [1] 0.8439112
plot(evals[,13:19])

m_bty_gen <- lm(score ~ bty_avg + gender, data = evals)
summary(m_bty_gen)
## 
## Call:
## lm(formula = score ~ bty_avg + gender, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8305 -0.3625  0.1055  0.4213  0.9314 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.74734    0.08466  44.266  < 2e-16 ***
## bty_avg      0.07416    0.01625   4.563 6.48e-06 ***
## gendermale   0.17239    0.05022   3.433 0.000652 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5287 on 460 degrees of freedom
## Multiple R-squared:  0.05912,    Adjusted R-squared:  0.05503 
## F-statistic: 14.45 on 2 and 460 DF,  p-value: 8.177e-07

Exercise 7: 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.

plot(m_bty)

# The conditions still appear to be met since the residuals vs fitted plot still shows no pattern, the scale-location plot still shows equal variance, and the qq plot of the residuals is still fairly normal, so the P-values and parameter estimates seem trustworthy.

Exercise 8: Is bty_avg still a significant predictor of score? Has the addition of gender to the model changed the parameter estimate for bty_avg?

Yes, it is still a significant predictor of score, albeit a weak predictor as the R sqaured value is still very small. The addtion of gender has caused the R sqaured value to increase to 0.059 and caused the P-value to become even smaller. The slope coefficient for bty_avg is now 0.074, rather than 0.066, so the addition of gender has caused the parameter estimate for bty_avg to change.

multiLines(m_bty_gen)

Exercise 9: What is the equation of the line corresponding to males? (Hint: For males, the parameter estimate is multiplied by 1.) For two professors who received the same beauty rating, which gender tends to have the higher course evaluation score?

The equation of the line corresponding to males is y = 3.91 + 0.07x. The male gender tends to have higher course evaluation scores due to the larger y-intercept. This can also be seen from the multiline scatterplot.

Exercsie 10: Create a new model called m_bty_rank with gender removed and rank added in. How does R appear to handle categorical variables that have more than two levels? Note that the rank variable has three levels: teaching, tenure track, tenured.

m_bty_rank <- lm(score ~ bty_avg + rank, data = evals)
summary(m_bty_rank)
## 
## Call:
## lm(formula = score ~ bty_avg + rank, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8713 -0.3642  0.1489  0.4103  0.9525 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       3.98155    0.09078  43.860  < 2e-16 ***
## bty_avg           0.06783    0.01655   4.098 4.92e-05 ***
## ranktenure track -0.16070    0.07395  -2.173   0.0303 *  
## ranktenured      -0.12623    0.06266  -2.014   0.0445 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5328 on 459 degrees of freedom
## Multiple R-squared:  0.04652,    Adjusted R-squared:  0.04029 
## F-statistic: 7.465 on 3 and 459 DF,  p-value: 6.88e-05
# R appears to create n - 1 dummy variables for variables with n categories. 

The Search for the Best Model

Exercise 11: Which variable would you expect to have the highest p-value in this model? Why? Hint: Think about which variable would you expect to not have any association with the professor score.

I would expect any variable not directly or indirectly associated with a professor’s beauty or general perception to have a high p-value. If I had to choose one that would be least associated, I would choose cls_students or cls_profs since I don’t see how the number of students in a class or the number of teachers of a class could affect the perception of a teacher.

m_full <- lm(score ~ rank + ethnicity + gender + language + age + cls_perc_eval 
             + cls_students + cls_level + cls_profs + cls_credits + bty_avg 
             + pic_outfit + pic_color, data = evals)
summary(m_full)
## 
## Call:
## lm(formula = score ~ rank + ethnicity + gender + language + age + 
##     cls_perc_eval + cls_students + cls_level + cls_profs + cls_credits + 
##     bty_avg + pic_outfit + pic_color, data = evals)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.77397 -0.32432  0.09067  0.35183  0.95036 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            4.0952141  0.2905277  14.096  < 2e-16 ***
## ranktenure track      -0.1475932  0.0820671  -1.798  0.07278 .  
## ranktenured           -0.0973378  0.0663296  -1.467  0.14295    
## ethnicitynot minority  0.1234929  0.0786273   1.571  0.11698    
## gendermale             0.2109481  0.0518230   4.071 5.54e-05 ***
## languagenon-english   -0.2298112  0.1113754  -2.063  0.03965 *  
## age                   -0.0090072  0.0031359  -2.872  0.00427 ** 
## cls_perc_eval          0.0053272  0.0015393   3.461  0.00059 ***
## cls_students           0.0004546  0.0003774   1.205  0.22896    
## cls_levelupper         0.0605140  0.0575617   1.051  0.29369    
## cls_profssingle       -0.0146619  0.0519885  -0.282  0.77806    
## cls_creditsone credit  0.5020432  0.1159388   4.330 1.84e-05 ***
## bty_avg                0.0400333  0.0175064   2.287  0.02267 *  
## pic_outfitnot formal  -0.1126817  0.0738800  -1.525  0.12792    
## pic_colorcolor        -0.2172630  0.0715021  -3.039  0.00252 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.498 on 448 degrees of freedom
## Multiple R-squared:  0.1871, Adjusted R-squared:  0.1617 
## F-statistic: 7.366 on 14 and 448 DF,  p-value: 6.552e-14

Exercise 12: Check your suspicions from the previous exercise. Include the model output in your response.

It seems that cls_profs has the highest P-value of any of the variables in the model at p = 0.778 and cls_levelupper and cls_students had the second and third highest P-values at 0.29 and 0.22 respectively.

Exercise 13: Interpret the coefficient associated with the ethnicity variable.

Since ethcnity is a dichotomous variable, and since the dummy variable is ethnicitynot minority, when ethnicity is the category “not minority”, the evaluation score will tend to be higher than it would when it is the category “minority”.

That is, the estimate for ethnicity reflects how much higher a professor is expected to score if he/she is of a certain ethncity while holding all other variables constant. In this case, it would mean considering professors of the same rank, the same gender, the same age, the same language, the same credits, the same bty_avg score and so on for a non-minority as well as a minority. Since minorities are assigned the numerical value of 0, all else being equal, a non-minority professor would be expected to have a score of 1*0.12 more than a minority professor.

Exercise 14: Drop the variable with the highest p-value and re-fit the model. Did the coefficients and significance of the other explanatory variables change? (One of the things that makes multiple regression interesting is that coefficient estimates depend on the other variables that are included in the model.) If not, what does this say about whether or not the dropped variable was collinear with the other explanatory variables?

m_full <- lm(score ~ rank + ethnicity + gender + language + age + cls_perc_eval 
             + cls_students + cls_level + cls_credits + bty_avg 
             + pic_outfit + pic_color, data = evals)
summary(m_full)
## 
## Call:
## lm(formula = score ~ rank + ethnicity + gender + language + age + 
##     cls_perc_eval + cls_students + cls_level + cls_credits + 
##     bty_avg + pic_outfit + pic_color, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.7836 -0.3257  0.0859  0.3513  0.9551 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            4.0872523  0.2888562  14.150  < 2e-16 ***
## ranktenure track      -0.1476746  0.0819824  -1.801 0.072327 .  
## ranktenured           -0.0973829  0.0662614  -1.470 0.142349    
## ethnicitynot minority  0.1274458  0.0772887   1.649 0.099856 .  
## gendermale             0.2101231  0.0516873   4.065 5.66e-05 ***
## languagenon-english   -0.2282894  0.1111305  -2.054 0.040530 *  
## age                   -0.0089992  0.0031326  -2.873 0.004262 ** 
## cls_perc_eval          0.0052888  0.0015317   3.453 0.000607 ***
## cls_students           0.0004687  0.0003737   1.254 0.210384    
## cls_levelupper         0.0606374  0.0575010   1.055 0.292200    
## cls_creditsone credit  0.5061196  0.1149163   4.404 1.33e-05 ***
## bty_avg                0.0398629  0.0174780   2.281 0.023032 *  
## pic_outfitnot formal  -0.1083227  0.0721711  -1.501 0.134080    
## pic_colorcolor        -0.2190527  0.0711469  -3.079 0.002205 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4974 on 449 degrees of freedom
## Multiple R-squared:  0.187,  Adjusted R-squared:  0.1634 
## F-statistic: 7.943 on 13 and 449 DF,  p-value: 2.336e-14
# The coefficients and significance of the other explanatory variables hardly changed. This clearly indicates that this variables was collinear or correlated with the other explanatory variables, which is why subtracting it did not alter the model. 

Exercise 15: Using backward-selection and p-value as the selection criterion, determine the best model. You do not need to show all steps in your answer, just the output for the final model. Also, write out the linear model for predicting score based on the final model you settle on.

m_full <- lm(score ~ rank + ethnicity + gender + language + age + cls_perc_eval 
             + cls_credits + bty_avg 
             + pic_outfit + pic_color, data = evals)
summary(m_full)
## 
## Call:
## lm(formula = score ~ rank + ethnicity + gender + language + age + 
##     cls_perc_eval + cls_credits + bty_avg + pic_outfit + pic_color, 
##     data = evals)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.78424 -0.31397  0.09261  0.35904  0.92154 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            4.152893   0.280892  14.785  < 2e-16 ***
## ranktenure track      -0.142239   0.081819  -1.738 0.082814 .  
## ranktenured           -0.083092   0.065532  -1.268 0.205469    
## ethnicitynot minority  0.143509   0.075972   1.889 0.059535 .  
## gendermale             0.208080   0.051159   4.067 5.61e-05 ***
## languagenon-english   -0.222515   0.108876  -2.044 0.041558 *  
## age                   -0.009074   0.003103  -2.924 0.003629 ** 
## cls_perc_eval          0.004841   0.001441   3.359 0.000849 ***
## cls_creditsone credit  0.472669   0.110652   4.272 2.37e-05 ***
## bty_avg                0.043578   0.017257   2.525 0.011903 *  
## pic_outfitnot formal  -0.136594   0.068998  -1.980 0.048347 *  
## pic_colorcolor        -0.189905   0.067697  -2.805 0.005246 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4975 on 451 degrees of freedom
## Multiple R-squared:  0.1832, Adjusted R-squared:  0.1632 
## F-statistic: 9.193 on 11 and 451 DF,  p-value: 6.364e-15
# The model above is the best model I could come up with in terms of adjusted R squared value and p-value. It has the lowest p-value and the second lowest adjusted R squared value outside of the original model that contained all variables.

Exercise 16: Verify that the conditions for this model are reasonable using diagnostic plots.

plot(m_full)

# The conditions of the model are reasonable given that there is no pattern within the plot of the residuals vs fitted. The qq plot of the residuals is also fiarly normal. In addition, the scale location plot line seems to be fairly flat, which indicates equal variance or homoskedacity.

Exercise 17: The original paper describes how these data were gathered by taking a sample of professors from the University of Texas at Austin and including all courses that they have taught. Considering that each row represents a course, could this new information have an impact on any of the conditions of linear regression?

Yes, because each class represented all courses a professor has taught, not a class, each row represents an group of classes over time rather than a single class. This could invalidate the conditions of the linear regression since the original numbers are presumably all averages of the class evaluations over time for a given course.

Exercise 18: Based on your final model, describe the characteristics of a professor and course at University of Texas at Austin that would be associated with a high evaluation score.

A professor at the University of Texas would have a high score if the professor were male, english-speaking, not a minority, formal in clothing, had a black and white photo, and taught a one credit course.

Exercise 19: Would you be comfortable generalizing your conclusions to apply to professors generally (at any university)? Why or why not?

Definitely not. An adjusted R-squared value of 0.18 is extremely low and indicates a correlation coefficient or R value that is below 0.5, which it the absolute minimum R value for establishing an association or dependence between a set of explanatory variables and a response variable. Moreover, this was a single sample of a single school in Austin, TX rather than a group of samples from various areas of the world. The sample size would need to include drastically and be stratified across the globe in order for any conclusions about professors in general to be drawn and, moreover, the R and R squared values would have to be higher.