2025-03-30

About the Dataset

This analysis explores a dataset on student mental health, focusing on:

  • Stress factors: Academic, social, financial, and personal factors affecting student mental health
  • Coping mechanisms: Strategies students use to manage stress
  • Data collection: 760 student records with 20 variables
  • Key variables:
    • Demographics (Age, Gender)
    • Academic metrics (GPA, Study Hours)
    • Lifestyle factors (Sleep, Exercise, Social Media)
    • Mental health indicators (Stress Level, Counseling)
    • Support systems (Family Support, Coping Mechanisms)

```
## 'data.frame':    760 obs. of  19 variables:
##  $ Age                     : int  22 25 24 20 28 24 23 25 19 21 ...
##  $ Gender                  : Factor w/ 8 levels "Agender","Bigender",..: 3 3 3 6 6 3 3 6 3 6 ...
##  $ GPA                     : int  2 0 0 2 0 2 1 3 3 3 ...
##  $ Study_Hours             : int  9 28 45 8 14 27 30 12 19 4 ...
##  $ Social_Media            : int  2 0 3 7 6 7 5 0 1 1 ...
##   [list output truncated]
```

Data Structure & Statistics

Age GPA Mental_Stress Sleep_Hours Exercise_Hours Social_Media
Min. :18.00 Min. :0.000 Min. : 1.000 Min. : 4.000 Min. : 0.000 Min. :0.000
1st Qu.:21.00 1st Qu.:1.000 1st Qu.: 3.000 1st Qu.: 6.000 1st Qu.: 2.000 1st Qu.:2.000
Median :24.00 Median :2.000 Median : 5.000 Median : 8.000 Median : 5.000 Median :4.000
Mean :23.92 Mean :1.996 Mean : 5.363 Mean : 8.093 Mean : 4.934 Mean :4.234
3rd Qu.:27.00 3rd Qu.:3.000 3rd Qu.: 8.000 3rd Qu.:10.000 3rd Qu.: 8.000 3rd Qu.:7.000
Max. :30.00 Max. :4.000 Max. :10.000 Max. :12.000 Max. :10.000 Max. :8.000

Gender distribution

Gender Distribution
Gender Count Percentage
Agender 14 1.8%
Bigender 16 2.1%
Female 336 44.2%
Genderfluid 12 1.6%
Genderqueer 7 0.9%
Male 353 46.4%
Non-binary 10 1.3%
Polygender 12 1.6%

Stress Levels Overview

# Create a histogram of mental stress levels
p1 <- ggplot(student_data, aes(x = Mental_Stress)) +
  geom_histogram(binwidth = 1, fill = "#8C1D40", color = "black", alpha = 0.7) +
  theme_minimal() +
  labs(title = "Distribution of Mental Stress Levels",
       x = "Mental Stress Level (1-10)",
       y = "Number of Students") +
  theme(plot.title = element_text(hjust = 0.5))

# Create a boxplot by gender
p2 <- ggplot(student_data, aes(x = Gender, y = Mental_Stress, fill = Gender)) +
  geom_boxplot(alpha = 0.7) +
  theme_minimal() +
  labs(title = "Stress Levels by Gender",
       x = "Gender",
       y = "Mental Stress Level") +
  theme(legend.position = "none", 
        plot.title = element_text(hjust = 0.5),
        axis.text.x = element_text(size = 8, angle = 45))

Stress Levels Overview

Academic Factors & Stress (GGPlot)

Lifestyle Factors & Stress (3D Plotly)

# 3D plotly scatter plot with sleep, exercise, and stress
graphs <- plot_ly(student_data, 
        x = ~Sleep_Hours, 
        y = ~Exercise_Hours, 
        z = ~Mental_Stress, 
        color = ~Gender, 
        type = "scatter3d", 
        mode = "markers",
        marker = list(size = 4),
        text = ~paste("Age:", Age, 
                     "<br>GPA:", GPA,
                     "<br>Social Media:", Social_Media)) %>%
  layout(title = "Sleep, Exercise & Mental Stress",
         scene = list(
           xaxis = list(title = "Sleep (Hours/Night)"),
           yaxis = list(title = "Exercise (Hours/Week)"),
           zaxis = list(title = "Mental Stress Level")
         ))

Lifestyle Factors & Stress (3D Plotly)

Social Factors & Support Systems

Coping Mechanisms Effectiveness (R Code)

# Create interactive bar chart
graphs <- plot_ly(coping_effectiveness, 
        x = ~reorder(Stress_Coping_Mechanisms, -avg_stress), 
        y = ~avg_stress, 
        error_y = list(
          type = "data", 
          array = ~sd_stress/sqrt(count),
          color = '#000000',
          thickness = 0.5
        ),
        type = "bar",
        marker = list(color = "#8C1D40", 
                     line = list(color = "#000000", width = 1))) %>%
  layout(title = "Most Effective Coping Mechanisms",
         xaxis = list(title = "Coping Mechanism", tickangle = 45),
         yaxis = list(title = "Average Stress Level (Lower is Better)"),
         margin = list(b = 120))

Coping Mechanisms Effectiveness (Graph)

Counseling Impact (GGPlot)

# Calculate stress by counseling and gender
counseling_gender <- student_data %>%
  group_by(Gender, Counseling) %>%
  summarise(
    avg_stress = mean(Mental_Stress),
    count = n(),
    .groups = 'drop'
  )

# Create a grouped bar chart
graphs <- ggplot(counseling_gender, 
       aes(x = Gender, y = avg_stress, fill = Counseling)) +
  geom_bar(stat = "identity", position = "dodge", alpha = 0.8) +
  geom_text(aes(label = round(avg_stress, 1), 
                y = avg_stress + 0.3),
            position = position_dodge(width = 0.9),
            size = 3) +
  theme_minimal() +
  labs(title = "Impact of Counseling on Stress Levels by Gender",
       x = "Gender",
       y = "Average Stress Level",
       fill = "Attended Counseling") +
  scale_fill_manual(values = c("Yes" = "#8C1D40", "No" = "#FFC627")) +
  theme(plot.title = element_text(hjust = 0.5), axis.text.x = element_text(size = 8,angle = 45, hjust = 0.5))

Counseling Impact (GGPlot)

Variables Correlation Heatmap

Statistical Analysis: Stress Predictors

Regression Coefficients and p-values
Estimate Pr(>|t|)
(Intercept) 5.2407679 0.0000000
GPA -0.0689699 0.3541694
Sleep_Hours 0.0718266 0.0767747
Social_Media 0.0134083 0.7445569
Exercise_Hours -0.0609762 0.0752378
Family_Support 0.0293913 0.6946449
Financial_Stress 0.0591168 0.4161475
Peer_Pressure -0.1150311 0.1311298

ANOVA: Stress Differences by Coping Mechanism

##                           Df Sum Sq Mean Sq F value Pr(>F)
## Stress_Coping_Mechanisms   9     93  10.314   1.227  0.275
## Residuals                750   6303   8.404
Top 5 Coping Mechanisms by Average Stress Level
Stress_Coping_Mechanisms mean_stress
Travelling 4.529412
Walking or Nature Walks 5.291139
Social Media Engagement 5.329114
Spending Time Alone 5.343284
Watching Sports 5.346154

Key Findings

  1. Academic factors: Lower GPA correlates with higher stress levels

  2. Lifestyle impact: Students with more sleep and regular exercise report lower stress

  3. Social support: Strong family support significantly reduces mental stress

  4. Effective coping mechanisms:

    • Walking and Travelling show the strongest association with lower stress
    • Social engagement and reading also appear effective
  5. Counseling benefits: Students attending counseling show lower average stress levels

Recommendations

  • Academic institutions should:
    • Provide stress management resources
    • Promote counseling services
    • Consider academic pressure effects
  • Students should prioritize:
    • Regular sleep habits (7+ hours)
    • Physical activity (even 2-3 hours weekly)
    • Seeking support when needed
    • Using evidence-based stress reduction techniques
  • Future research could explore:
    • Longitudinal changes in stress levels
    • Effectiveness of specific intervention programs
    • Diversity considerations in stress management