Professor Archetypes

Author

Lauren Russell


title: “Professor Archetypes in RateMyProfessor Reviews”
author: “Your Name”
format:
html:
theme: cosmo
toc: true
code-fold: true
code-summary: “Show code”
execute:
warning: false
message: false


## Introduction

RateMyProfessor is commonly used by students when selecting courses. This project examines how students describe professors in written reviews and whether certain professor archetypes receive higher ratings.

**Research Question:**
What professor archetypes emerge from RateMyProfessor comments, and which archetypes receive the highest ratings?



## Data

The dataset contains student reviews from RateMyProfessor, including:

- Comment text
- Star rating
- Difficulty rating
- Would-take-again indicator

After filtering missing comments, 19,886 reviews were analyzed.



## Setup

```{r}
library(tidyverse)
library(tidytext)
library(topicmodels)
library(ggplot2)

RateMyProfessor_Sample_data <- read_csv(“RateMyProfessor_Sample data.csv”)

rmp_clean <- RateMyProfessor_Sample_data %>%
select(comments, star_rating, diff_index, would_take_agains) %>%
filter(!is.na(comments)) %>%
mutate(doc_id = row_number())
```



## Text Preprocessing

```{r}
tokens <- rmp_clean %>%
unnest_tokens(word, comments) %>%
anti_join(stop_words)
```



## Topic Modeling

```{r}
dtm <- tokens %>%
count(doc_id, word) %>%
tidytext::cast_dtm(doc_id, word, n)

lda_model <- LDA(dtm, k = 5, control = list(seed = 1234))
```



## Professor Archetypes

```{r}
topics <- tidy(lda_model, matrix = “beta”)

top_terms <- topics %>%
group_by(topic) %>%
slice_max(beta, n = 10) %>%
ungroup()

ggplot(top_terms, aes(beta, reorder_within(term, beta, topic))) +
geom_col() +
facet_wrap(~ topic, scales = “free”) +
scale_y_reordered() +
labs(
title = “Professor Archetypes Based on Student Language”,
x = NULL,
y = “Term Importance”
)
```



## Assign Reviews to Archetypes

```{r}
assignments <- tidy(lda_model, matrix = “gamma”) %>%
group_by(document) %>%
slice_max(gamma) %>%
ungroup() %>%
mutate(document = as.integer(document))

rmp_topics <- assignments %>%
left_join(rmp_clean, by = c(“document” = “doc_id”))
```



## Ratings by Archetype

```{r}
ratings_by_topic <- rmp_topics %>%
group_by(topic) %>%
summarise(
avg_rating = mean(star_rating, na.rm = TRUE),
avg_difficulty = mean(diff_index, na.rm = TRUE),
n = n()
)
```



## Average Rating by Professor Archetype

```{r}
ggplot(ratings_by_topic,
aes(x = reorder(factor(topic), -avg_rating),
y = avg_rating)) +
geom_col() +
coord_flip() +
coord_cartesian(ylim = c(3.2, 3.8)) +
labs(
x = “Professor Archetype”,
y = “Average Rating”,
title = “Average Rating by Professor Archetype”
)
```



## Average Difficulty by Professor Archetype

```{r}
ggplot(ratings_by_topic,
aes(x = reorder(factor(topic), -avg_difficulty),
y = avg_difficulty)) +
geom_col() +
coord_flip() +
labs(
x = “Professor Archetype”,
y = “Average Difficulty”,
title = “Average Difficulty by Professor Archetype”
)
```



## Key Findings

- Supportive professors received the highest ratings
- Tough but helpful professors were also rated highly
- Easy professors were not the highest rated
- Students appear to value support and clarity over ease



## Limitations

- Reviews are voluntary and may introduce selection bias
- Comments are short and informal
- Ratings reflect perception rather than teaching effectiveness
- Topic interpretation is subjective



## Conclusion

Topic modeling identified five professor archetypes from student comments.
Supportive and challenging but helpful instructors received the highest ratings.
Students appear to reward clarity, engagement, and learning more than ease.