Row

Relationship Between Negative Emotions in Discussion Posts and Final Grades

Row

Quartiles, Median, and Outliers for Negative Emotion

Distribution of Final Grade by Number of Students

---
title: "Do negative emotions in discussion posts lead to a lower grade?"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    theme:
      version: 4
      bootswatch: minty
    source_code: embed
---

```{r}

```

```{r setup, include=FALSE}

library(flexdashboard)
library(tidyverse)
library(janitor)

course_text <- read_csv("data/course-text.csv") |>
  clean_names()

data_to_viz1 <- course_text |>
  select(course_id, 
         gender,
         time_spent_hours, 
         final_grade) |>
  separate(course_id, c("subject", "semester", "section")) |>
  mutate(subject = recode(subject, 
                          "AnPhA" = "Anatomy",
                          "BioA" = "Biology", 
                          "FrScA" = "Forensics", 
                          "OcnA" =  "Oceanography", 
                          "PhysA" = "Physics"))
liwc_data <- read_csv("data/liwc-data.csv") |>
  clean_names()
  
  data_to_viz2 <- liwc_data |>
  select(course_id,
         negemo,
         posemo,
         social,
         tone,
         anx) |>
  separate(course_id, c("subject", "semester", "section")) |>
  mutate(subject = recode(subject, 
                          "AnPhA" = "Anatomy",
                          "BioA" = "Biology", 
                          "FrScA" = "Forensics", 
                          "OcnA" =  "Oceanography", 
                          "PhysA" = "Physics"))
data_to_viz <- inner_join(data_to_viz1, data_to_viz2)
```

## Inputs {.sidebar}

Yes. There is a positive correlation between negative emotions and low final grades. Each of the points in the scatter-plot indicates the number of negative emotions found in discussion posts and their final grade. There seems to be a correlation between negative emotions and final grade, with students receiving a variation of very low grades, all below 10%, with the highest grade being between 6 and 7% if any negative emotions were displayed in their discussion posts.

The box-plot to the right show the distributions of negative emotions in each subject area. It appears that negative emotions are more prevalent in biology, having the highest average of negative emotions, and the least amount being present in physics.

The histogram shows the distributions of final grades across all subjects. Student scores below 50% have very low distributions, signifying that while present, these instances are not the norm. However, the box-plot showed that there are higher negative emotion sentiments within the Biology class. The histogram further confirms this, with the lowest student final grades being in the Biology course. As such, it does appear that there is a high correlation between negative emotion and low final grades.

## Row

### Relationship Between Negative Emotions in Discussion Posts and Final Grades

```{r}

data_to_viz  %>% 
  ggplot() +
  geom_point(mapping = aes(x = final_grade, 
                       y = negemo, color= subject), 
             alpha = .5) +
  geom_smooth(mapping = aes(x = final_grade, 
                            y = negemo,
                            # color = final_grade
                            weight = 1),
              color = "black", 
              method = loess,
              se = FALSE) +
  ylim(0, 10) + 
  xlim(0, 100) +
  # facet_wrap(~subject, ncol = 3) +
  labs(
    title = "Do negative emotions in discussion posts lead to a lower grade?",
       y = "Final Grade",
       x = "Negative Emotions",
    caption = ""
       ) +
  theme_minimal() +
  theme(legend.position = "right",
        panel.grid.minor = element_blank()) +
  scale_color_brewer(palette = "Dark2",
                     name = "Subject")

```

## Row

### Quartiles, Median, and Outliers for Negative Emotion

```{r}
data_to_viz  %>% 
  ggplot() +
  geom_boxplot(mapping = aes(x = negemo,
                       color = subject),
             alpha = .25) +
  facet_wrap(~subject, ncol = 1) +
  labs(# title = "Do negative emotions in discussion posts lead to a lower grade?",
       y = "Course Subject",
       x = "Negative Emotion",
     #  subtitle = "Yes, it appears that they do.",
     #  caption = "Based on negative emotions displayed in online discussion posts for each class, there appears to be a correlation"
     ) +
  theme_void() +
  theme(legend.position = "none",
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        axis.title.x = element_text(),
        axis.text.x = element_text()) +
  scale_color_brewer(palette = "Dark2",
                     name = "Subject") +
  scale_x_continuous(breaks = seq(0.05, 10, by = .75))
 # scale_y_discrete(limits=rev)
```

### Distribution of Final Grade by Number of Students

```{r}
data_to_viz |>
  ggplot() +
  geom_histogram(mapping = aes(
                       x = final_grade,
                       #y = stat(count/sum(count)),
                       color = subject),
                 fill = NA
                       ) +
  facet_wrap(~subject, ncol = 1) +
  labs(# title = "Does negative emotion in discussion posts have a negative impact on final grades?",
       y = "% of Students",
       x = "Final Grades",
     #  subtitle = "Yes.",
     #  caption = 
     ) +
  theme_void() +
  theme(legend.position = "none",
        axis.text.y=element_blank(),
        axis.ticks.y=element_blank(),
        axis.title.x = element_text(),
        axis.text.x = element_text()) +
  scale_color_brewer(palette = "Dark2",
                     name = "Subject") +
  scale_x_continuous(breaks = seq(0, 100, by = 10))
```