Lab 8

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
download.file("http://www.openintro.org/stat/data/evals.RData", destfile = "evals.RData")

load("evals.RData")

summary(evals)
##      score                 rank            ethnicity      gender   
##  Min.   :2.300   teaching    :102   minority    : 64   female:195  
##  1st Qu.:3.800   tenure track:108   not minority:399   male  :268  
##  Median :4.300   tenured     :253                                  
##  Mean   :4.175                                                     
##  3rd Qu.:4.600                                                     
##  Max.   :5.000                                                     
##         language        age        cls_perc_eval     cls_did_eval   
##  english    :435   Min.   :29.00   Min.   : 10.42   Min.   :  5.00  
##  non-english: 28   1st Qu.:42.00   1st Qu.: 62.70   1st Qu.: 15.00  
##                    Median :48.00   Median : 76.92   Median : 23.00  
##                    Mean   :48.37   Mean   : 74.43   Mean   : 36.62  
##                    3rd Qu.:57.00   3rd Qu.: 87.25   3rd Qu.: 40.00  
##                    Max.   :73.00   Max.   :100.00   Max.   :380.00  
##   cls_students    cls_level      cls_profs         cls_credits 
##  Min.   :  8.00   lower:157   multiple:306   multi credit:436  
##  1st Qu.: 19.00   upper:306   single  :157   one credit  : 27  
##  Median : 29.00                                                
##  Mean   : 55.18                                                
##  3rd Qu.: 60.00                                                
##  Max.   :581.00                                                
##   bty_f1lower     bty_f1upper     bty_f2upper      bty_m1lower   
##  Min.   :1.000   Min.   :1.000   Min.   : 1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:4.000   1st Qu.: 4.000   1st Qu.:2.000  
##  Median :4.000   Median :5.000   Median : 5.000   Median :3.000  
##  Mean   :3.963   Mean   :5.019   Mean   : 5.214   Mean   :3.413  
##  3rd Qu.:5.000   3rd Qu.:7.000   3rd Qu.: 6.000   3rd Qu.:5.000  
##  Max.   :8.000   Max.   :9.000   Max.   :10.000   Max.   :7.000  
##   bty_m1upper     bty_m2upper       bty_avg           pic_outfit 
##  Min.   :1.000   Min.   :1.000   Min.   :1.667   formal    : 77  
##  1st Qu.:3.000   1st Qu.:4.000   1st Qu.:3.167   not formal:386  
##  Median :4.000   Median :5.000   Median :4.333                   
##  Mean   :4.147   Mean   :4.752   Mean   :4.418                   
##  3rd Qu.:5.000   3rd Qu.:6.000   3rd Qu.:5.500                   
##  Max.   :9.000   Max.   :9.000   Max.   :8.167                   
##        pic_color  
##  black&white: 78  
##  color      :385  
##                   
##                   
##                   
## 

Exercise 1

It is an observational study and not an experiment. It seems that it is not possible to say for sure that attractiveness and not productivity is responsible for better ranking.

Exercise 2.

Distribution is somewhat normal not heavily skewed on the right. Students seem to evaluate the professors generally positively. I have expected it. Most professors are competent and they deserve high evaluation.

library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
hist(evals$score)

Exercise 3

Relationship between 2 variables has slight negative dependency.

plot(evals$age,evals$bty_avg)

scatterplot(age~bty_avg, data=evals)

cor(evals$age, evals$bty_avg)
## [1] -0.3046034
plot(evals$score ~ evals$bty_avg)

cor(evals$score, evals$bty_avg)
## [1] 0.1871424

Exercise 4

The first plot was too lined up along beauty average scores.

plot(jitter(evals$score,0.25) ~ jitter(evals$bty_avg,3))

Exercise 5

score=3.880+0.067*bty_avg. Beauty average score is significant predictor. It appears that beauty average score does not predict evaluation score very well (R squire ~0)

m_bty <- lm(score ~ bty_avg, data=evals)

summary(m_bty)
## 
## Call:
## lm(formula = score ~ bty_avg, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9246 -0.3690  0.1420  0.3977  0.9309 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.88034    0.07614   50.96  < 2e-16 ***
## bty_avg      0.06664    0.01629    4.09 5.08e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5348 on 461 degrees of freedom
## Multiple R-squared:  0.03502,    Adjusted R-squared:  0.03293 
## F-statistic: 16.73 on 1 and 461 DF,  p-value: 5.083e-05
plot(jitter(evals$score,0.25) ~ jitter(evals$bty_avg,3))

abline(m_bty)

Exercise 6

The model looks near normal. Residuals look random, so are model is linear. Constant variability condition looks to be met as well.

hist(m_bty$residuals)

qqnorm(m_bty$residuals)

qqline(m_bty$residuals) 

plot(m_bty$residuals ~ evals$bty_avg)

abline(h = 0, lty = 3)

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

The model looks near normal. Residuals look random, so are model is linear. Constant variability condition looks to be met as well.

hist(m_bty_gen$residuals)

qqnorm(m_bty_gen$residuals)

qqline(m_bty_gen$residuals) 

plot(m_bty_gen$residuals ~ evals$bty_avg)

abline(h = 0, lty = 3)

plot(m_bty_gen$residuals ~ evals$gender)

abline(h = 0, lty = 3)

Exercise 8.

Beauty average score is still significant predictor of score. Parameter estimate for beauty average score has changed - it got bigger.

Exercise 9.

The male line is above the female line. Male seems to have higher score with the same beauty ranking.

multiLines(m_bty_gen)

Exercise 10.

R converted rank into two variables.

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

Exercise 11

It is possible that age would play a role. Older professors are more experienced and probably more liked.

Exercise 12

I was wrong. cls_creditsone credit seems to fit the best. p-value is 1.84e-05.

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 13

It appears from the model that non-minority professor will get slightly higher score. The variable does not appear to fit well.

Exercise 14.

The coefficients of variables and their p-values changed but only slightly. It does not look like the variable has high correlation with other variables.

m_full1 <- 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_full1)
## 
## 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

Exercise 14.

score= 3.69702+0.16428 x gendermale+0.50168 x cls_creditsone credit+0.07999 x bty_avg

m_full2 <- lm(score ~ rank + ethnicity + gender + language + age + cls_perc_eval 
             + cls_students + cls_credits + bty_avg 
             + pic_outfit + pic_color, data = evals)

summary(m_full2)
## 
## Call:
## lm(formula = score ~ rank + ethnicity + gender + language + age + 
##     cls_perc_eval + cls_students + cls_credits + bty_avg + pic_outfit + 
##     pic_color, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.7761 -0.3187  0.0875  0.3547  0.9367 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            4.0856255  0.2888881  14.143  < 2e-16 ***
## ranktenure track      -0.1420696  0.0818201  -1.736 0.083184 .  
## ranktenured           -0.0895940  0.0658566  -1.360 0.174372    
## ethnicitynot minority  0.1424342  0.0759800   1.875 0.061491 .  
## gendermale             0.2037722  0.0513416   3.969 8.40e-05 ***
## languagenon-english   -0.2093185  0.1096785  -1.908 0.056966 .  
## age                   -0.0087287  0.0031224  -2.795 0.005404 ** 
## cls_perc_eval          0.0053545  0.0015306   3.498 0.000515 ***
## cls_students           0.0003573  0.0003585   0.997 0.319451    
## cls_creditsone credit  0.4733728  0.1106549   4.278 2.31e-05 ***
## bty_avg                0.0410340  0.0174449   2.352 0.019092 *  
## pic_outfitnot formal  -0.1172152  0.0716857  -1.635 0.102722    
## pic_colorcolor        -0.1973196  0.0681052  -2.897 0.003948 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4975 on 450 degrees of freedom
## Multiple R-squared:  0.185,  Adjusted R-squared:  0.1632 
## F-statistic:  8.51 on 12 and 450 DF,  p-value: 1.275e-14
m_full3 <- lm(score ~ ethnicity + gender + language + age + cls_perc_eval + cls_credits + bty_avg 
             + pic_outfit + pic_color, data = evals)

summary(m_full3)
## 
## Call:
## lm(formula = score ~ ethnicity + gender + language + age + cls_perc_eval + 
##     cls_credits + bty_avg + pic_outfit + pic_color, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8455 -0.3221  0.1013  0.3745  0.9051 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.907030   0.244889  15.954  < 2e-16 ***
## ethnicitynot minority  0.163818   0.075158   2.180 0.029798 *  
## gendermale             0.202597   0.050102   4.044 6.18e-05 ***
## languagenon-english   -0.246683   0.106146  -2.324 0.020567 *  
## age                   -0.006925   0.002658  -2.606 0.009475 ** 
## cls_perc_eval          0.004942   0.001442   3.427 0.000666 ***
## cls_creditsone credit  0.517205   0.104141   4.966 9.68e-07 ***
## bty_avg                0.046732   0.017091   2.734 0.006497 ** 
## pic_outfitnot formal  -0.113939   0.067168  -1.696 0.090510 .  
## pic_colorcolor        -0.180870   0.067456  -2.681 0.007601 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4982 on 453 degrees of freedom
## Multiple R-squared:  0.1774, Adjusted R-squared:  0.161 
## F-statistic: 10.85 on 9 and 453 DF,  p-value: 2.441e-15
m_full4 <- lm(score ~ ethnicity + gender + language + age + cls_perc_eval + cls_credits + bty_avg  + pic_color, data = evals)

summary(m_full4)
## 
## Call:
## lm(formula = score ~ ethnicity + gender + language + age + cls_perc_eval + 
##     cls_credits + bty_avg + pic_color, data = evals)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.85320 -0.32394  0.09984  0.37930  0.93610 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.771922   0.232053  16.255  < 2e-16 ***
## ethnicitynot minority  0.167872   0.075275   2.230  0.02623 *  
## gendermale             0.207112   0.050135   4.131 4.30e-05 ***
## languagenon-english   -0.206178   0.103639  -1.989  0.04726 *  
## age                   -0.006046   0.002612  -2.315  0.02108 *  
## cls_perc_eval          0.004656   0.001435   3.244  0.00127 ** 
## cls_creditsone credit  0.505306   0.104119   4.853 1.67e-06 ***
## bty_avg                0.051069   0.016934   3.016  0.00271 ** 
## pic_colorcolor        -0.190579   0.067351  -2.830  0.00487 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4992 on 454 degrees of freedom
## Multiple R-squared:  0.1722, Adjusted R-squared:  0.1576 
## F-statistic:  11.8 on 8 and 454 DF,  p-value: 2.58e-15
m_full5 <- lm(score ~ ethnicity + gender  + age + cls_perc_eval + cls_credits + bty_avg  + pic_color, data = evals)

summary(m_full5)
## 
## Call:
## lm(formula = score ~ ethnicity + gender + age + cls_perc_eval + 
##     cls_credits + bty_avg + pic_color, data = evals)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.85434 -0.33568  0.09247  0.38288  0.93903 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.690771   0.229181  16.104  < 2e-16 ***
## ethnicitynot minority  0.216955   0.071348   3.041  0.00250 ** 
## gendermale             0.201574   0.050220   4.014 6.99e-05 ***
## age                   -0.006034   0.002621  -2.302  0.02176 *  
## cls_perc_eval          0.004719   0.001439   3.278  0.00113 ** 
## cls_creditsone credit  0.527806   0.103839   5.083 5.44e-07 ***
## bty_avg                0.052431   0.016975   3.089  0.00213 ** 
## pic_colorcolor        -0.170149   0.066780  -2.548  0.01116 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5008 on 455 degrees of freedom
## Multiple R-squared:  0.1649, Adjusted R-squared:  0.1521 
## F-statistic: 12.84 on 7 and 455 DF,  p-value: 4.344e-15
m_full6 <- lm(score ~ ethnicity + gender  + cls_perc_eval + cls_credits + bty_avg  + pic_color, data = evals)

summary(m_full6)
## 
## Call:
## lm(formula = score ~ ethnicity + gender + cls_perc_eval + cls_credits + 
##     bty_avg + pic_color, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8404 -0.3361  0.1173  0.3785  0.9834 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.338114   0.171285  19.489  < 2e-16 ***
## ethnicitynot minority  0.211767   0.071648   2.956 0.003282 ** 
## gendermale             0.170708   0.048625   3.511 0.000491 ***
## cls_perc_eval          0.004886   0.001444   3.382 0.000780 ***
## cls_creditsone credit  0.538607   0.104221   5.168 3.55e-07 ***
## bty_avg                0.064201   0.016263   3.948 9.14e-05 ***
## pic_colorcolor        -0.148348   0.066416  -2.234 0.025993 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5032 on 456 degrees of freedom
## Multiple R-squared:  0.1552, Adjusted R-squared:  0.1441 
## F-statistic: 13.96 on 6 and 456 DF,  p-value: 1.325e-14
m_full7 <- lm(score ~ gender  + cls_perc_eval + cls_credits + bty_avg  + pic_color, data = evals)

summary(m_full7)
## 
## Call:
## lm(formula = score ~ gender + cls_perc_eval + cls_credits + bty_avg + 
##     pic_color, data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.7934 -0.3423  0.1099  0.3716  0.8750 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.586646   0.150482  23.834  < 2e-16 ***
## gendermale             0.189381   0.048620   3.895 0.000113 ***
## cls_perc_eval          0.004401   0.001447   3.041 0.002493 ** 
## cls_creditsone credit  0.463685   0.101944   4.548 6.93e-06 ***
## bty_avg                0.061047   0.016365   3.730 0.000215 ***
## pic_colorcolor        -0.175367   0.066338  -2.644 0.008487 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5074 on 457 degrees of freedom
## Multiple R-squared:  0.139,  Adjusted R-squared:  0.1296 
## F-statistic: 14.76 on 5 and 457 DF,  p-value: 1.977e-13
m_full8 <- lm(score ~ gender  + cls_perc_eval + cls_credits + bty_avg  , data = evals)

summary(m_full8)
## 
## Call:
## lm(formula = score ~ gender + cls_perc_eval + cls_credits + bty_avg, 
##     data = evals)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8421 -0.3384  0.1046  0.3841  1.0547 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           3.375919   0.128466  26.279  < 2e-16 ***
## gendermale            0.176206   0.048679   3.620 0.000328 ***
## cls_perc_eval         0.004729   0.001451   3.258 0.001204 ** 
## cls_creditsone credit 0.457260   0.102579   4.458 1.04e-05 ***
## bty_avg               0.072030   0.015932   4.521 7.84e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5107 on 458 degrees of freedom
## Multiple R-squared:  0.1259, Adjusted R-squared:  0.1182 
## F-statistic: 16.49 on 4 and 458 DF,  p-value: 1.25e-12
m_full9 <- lm(score ~ gender  + cls_credits + bty_avg  , data = evals)

summary(m_full9)
## 
## Call:
## lm(formula = score ~ gender + cls_credits + bty_avg, data = evals)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.81031 -0.34573  0.09878  0.39878  0.95640 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3.69702    0.08327  44.399  < 2e-16 ***
## gendermale             0.16428    0.04905   3.349 0.000877 ***
## cls_creditsone credit  0.50168    0.10273   4.884 1.44e-06 ***
## bty_avg                0.07999    0.01591   5.028 7.12e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.516 on 459 degrees of freedom
## Multiple R-squared:  0.1056, Adjusted R-squared:  0.09975 
## F-statistic: 18.06 on 3 and 459 DF,  p-value: 4.269e-11

Exercise 16

The model looks near normal. Residuals look random, so are model is linear. Constant variability condition looks to be met as well.

hist(m_full9$residuals)

qqnorm(m_full9$residuals)

qqline(m_full9$residuals) 

plot(m_full9$residuals ~ evals$bty_avg)

abline(h = 0, lty = 3)

plot(m_full9$residuals ~ evals$gender)

abline(h = 0, lty = 3)

plot(m_full9$residuals ~ evals$cls_credits)

abline(h = 0, lty = 3)

Exercise 17

All I see is that shorter one credit classes get professors higher score. However, it would mean that the same professor who teaches longer class can get lower evaluation.

Exercise 18

R squire looks very small so model is not very predictive, however a male, more attractive professor who teaches one credit classes seem to get higher score.

Exercise 19.

I would not feel comfortable to generalize these findings. I would like to have a bigger sample across different schools. I would like to have stronger predictive power.