Lab 07 - Modelling course evaluations

Published

November 21, 2024

Introduction

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. link.

For this assignment you 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 a slightly 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.

Important

This lab is longer than what you’ll be able to complete in an hour. We will be looking to see that you minimally ran and interpreted at least a single model (completed Part 2). If you’re able to finish the whole thing, awesome! If not, that’s OK.

Getting started

To get started, accept the lab07 assignment (link on Canvas), clone the repo (using SSH) into RStudio on datahub. Update the author name at the top of the .Rmd file in the YAML to be your name. And, then you’re ready to go!

Packages

In this lab we will work with the tidyverse and tidymodels packages. Be sure to load them in before continuing with the lab.

The data

In this lab you will first read in the data (‘evals-mod.csv’) from the data/ folder (provided in the template).

Codebook

Variable name Description
score Average professor evaluation score: (1) very unsatisfactory - (5) excellent
rank Rank of professor: teaching, tenure track, tenure
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 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 upper level male: (1) lowest - (10) highest

Exercises

Part 1: Data Wrangling & EDA

The rowwise function is useful for applying mathematical operations to each row.

Exercise 1

Create a new variable called bty_avg that is the average attractiveness score of the six students for each professor (bty_f1lower through bty_m2upper). Add this new variable to the evals data frame. Do this in one pipe, using the rowwise function. Since rowwise is new to you, incomplete code is given below to guide you in the right direction, however you will need to fill in the blanks.

___ <- evals |>
  rowwise() |>
  ___(bty_avg = mean( c( ___ ) )) |>
  ungroup()

Note that we end the pipeline with ungroup() to remove the effect of the rowwise function from earlier in the pipeline. The rowwise function works a lot like group_by, except it groups the data frame one row at a time so that any operations applied to the data frame is done once per each row. This is helpful for finding the mean beauty score for each row. However in the remainder of the analysis we don’t want to, say, calculate summary statistics for each row, or fit a model for each row. Hence we need to undo the effect of rowwise, which we can do with ungroup.

Exercise 2

Visualize 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? Include any summary statistics and visualizations you use in your response.

Exercise 3

Visualize and describe the relationship between score and the new variable you created, bty_avg.

Hint: See the help page for the function at http://ggplot2.tidyverse.org/reference/index.html.

Exercise 4

Replot the scatterplot from Exercise 3, but this time use
geom_jitter()? What does “jitter” mean? What was misleading about the initial scatterplot?

Part 2: Linear regression with a numerical predictor

Linear model is in the form \(\hat{y} = b_0 + b_1 x\).

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 evaluation score by average beauty rating (bty_avg). Based on the regression output, write the linear model.

Exercise 6

Replot your visualization from Exercise 3, and add the regression line to this plot in orange color. Turn off the shading for the uncertainty of the line.

Exercise 7

Interpret the slope of the linear model in context of the data.

Exercise 8

Interpret the intercept of the linear model in context of the data. Comment on whether or not the intercept makes sense in this context.

Exercise 9

Determine the \(R^2\) of the model and interpret it in context of the data.

Part 3: Multiple linear regression

Exercise 10

Fit a linear model: m_bty_gen, predicting average professor evaluation score based on average beauty rating (bty_avg) and gender. Write the linear model, and note the \(R^2\) and the adjusted \(R^2\).

Exercise 11

Interpret the slopes and intercept of m_bty_gen in context of the data.

Exercise 12

What percent of the variability in score is explained by the model m_bty_gen.

Exercise 13

What is the equation of the line corresponding to just male professors?

Exercise 14

For two professors who received the same beauty rating, which gender tends to have the higher course evaluation score?

Exercise 15

How do the adjusted \(R^2\) values of m_bty_gen and m_bty compare? What does this tell us about how useful gender is in explaining the variability in evaluation scores when we already have information on the beauty score of the professor.

Exercise 16

Compare the slopes of bty_avg under the two models (m_bty and m_bty_gen). Has the addition of gender to the model changed the parameter estimate (slope) for bty_avg?

Exercise 17

Create a new model called m_bty_rank with gender removed and rank added in. Write the equation of the linear model and interpret the slopes and intercept in context of the data.

Part 4: The search for the best model

Going forward, only consider the following variables as potential predictors: rank, ethnicity, gender, language, age, cls_perc_eval, cls_did_eval, cls_students, cls_level, cls_profs, cls_credits, bty_avg.

Exercise 18

Which variable, on its own, would you expect to be the worst predictor of evaluation scores? Why? Hint: Think about which variable would you expect to not have any association with the professor’s score.

Exercise 19

Check your suspicions from the previous exercise. Include the model output for that variable in your response.

Exercise 20

Suppose you wanted to fit a full model with the variables listed above. If you are already going to include cls_perc_eval and cls_students, which variable should you not include as an additional predictor? Why?

Exercise 21

Fit a full model with all predictors listed above (except for the one you decided to exclude) in the previous question.

Exercise 22

Using backward-selection (meaning fit all predictors and remove those that are not needed in the model) with adjusted R-squared 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.

Exercise 23

Interpret the slopes of one numerical and one categorical predictor based on your final model.

Exercise 24

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.

Exercise 25

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

Submit

Important

You’ll always want to knit your RMarkdown document to HTML and review that HTML document to ensure it includes all the information you want and looks as you intended, as we grade from the knit HTML.

Yay, you’re done! To finish up and submit, first knit your file to HTML. Be sure to select both your .Rmd and .html documents when choosing what to commit! Then, commit all remaining changes, use the commit message “Done with Lab 7! 💪”, and push. Before you wrap up the assignment, make sure all documents are updated on your GitHub repo.