library(tidyverse)

data_to_viz <- read_csv("data/data-to-explore.csv")

data_to_viz  %>% 
  select(subject, 
         percomp, 
         time_spent_hours,
         gender,
         proportion_earned) %>%
  mutate(subject = recode(subject, 
                          "AnPhA" = "Anatomy",
                          "BioA" = "Biology", 
                          "FrScA" = "Forensics", 
                          "OcnA" =  "Oceanography", 
                          "PhysA" = "Physics")) %>%
  mutate(grade = proportion_earned * 100) %>%
  ggplot(data = data_to_viz, mapping = aes(x = percomp, y = time_spent_hours)) +
  geom_point(mapping = aes(color = gender)) +
  geom_smooth() +
  facet_grid(. ~ subject) +
  labs(title = "Time Spent (Hours) and Perceived Competence by Subject",
     caption = "How does time spent in an online course vary by perceived competence and subject?",
     x = "Perceived Competence", 
     y = "Time Spent in Hours")

A “growth mindset” is one in which success is correlated with effort and experience rather than raw talent. Internationally, a growth mindset among students has been correlated with higher National Assessment of Educational Progress (NAEP) test scores, particularly in STEM fields. In the scatterplot above, students’ time spent (in hours) in an online course was compared to their perceived competence in the subject matter, separated by subject and color coded by gender. Results indicate that, in two of the five subjects (Forensics, Oceanography), increased perceived competence was related to increased time online, suggesting that a growth mindset may be at work in these students’ behaviors. However, in three of the five courses (Anatomy, Biology, and Physics), the pattern was less clear or demonstrated a negative relationship. Other factors may be at work, including amount of “offline” course material, prior experience with the subject, reason for enrolling including schedule constraints, interest in the subject matter, or perceived relevance to occupational tasks. (Separate analysis below indicated that male students, in particular, increase their time online as perceived competence increases, while female students spend roughly the same amount of time regardless of their perceived competence.) Thus, gender and associated constraints/conditions may also be a factor.

ggplot(data = data_to_viz, mapping = aes(x = percomp, y = time_spent_hours)) +
  geom_point(mapping = aes(color = subject)) +
  geom_smooth() +
  facet_grid(. ~ gender) +
  labs(title = "Time Spent (Hours) and Perceived Competence by Subject and Gender",
     caption = "How does gender interact with time spent and perceived competence in an online course?")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 399 rows containing non-finite values (stat_smooth).
## Warning: Removed 399 rows containing missing values (geom_point).