2025-11-02

Overview

Dataset: Mental Health and Social Media Balance Dataset (n ≈ 500)

  • Key Variables: Age, Gender, Daily Screen Time, Sleep Quality, Stress Level, Exercise Frequency, Social Media Platform, and Happiness Index (1-10 scales)

Research Questions

  1. How does daily screen time relate to happiness and stress levels?
  2. What is the relationship between sleep quality and exercise?
  3. Which social media platforms are most popular across age groups?
  4. How do different factors combine to influence mental health outcomes?

1. Screen Time vs Happiness and Stress

Key Findings:

  • Lower screen time (1-4 hours) means higher sleep quality and lower stress
  • High screen time (7+ hours) means poor sleep quality (3-5) and high stress (8-10)
  • Happiness levels is highest for users with moderate screen time and good sleep

2. Sleep Quality and Exercise

Key Findings:

  • Higher exercise frequency correlates with better avg sleep quality
  • “High (5+/week)” group show less variability in sleep quality
  • “No Exercise” group has widest range of sleep quality (poorest quality)

3. Platform Preference By Age

Key Findings:

  • Ages 16-25 prefer TikTok, X (Twitter), and Instagram
  • Ages 26–35 show diverse platform use
  • Older groups (46+) prefer Facebook and LinkedIn

Ggplot Code

To examine whether the relationship between screen time and happiness varies across genders, a scatter plot with a regression trend line was created using ggplot2.

ggplot(Q4, aes(x = Screen_Time,y = Happiness_Index, color = Gender)) +
  geom_point(alpha = 0.6, size = 2) +
  geom_smooth(method="lm", se=TRUE, linetype="dashed", linewidth=0.8) +
  scale_color_manual(values = c("Female" = "blue", "Male" = "red")) +
  labs(title = "Screen Time vs Happiness Index by Gender",
    x = "Daily Screen Time (hours)",
    y = "Happiness Index (1–10)",
    color = "Gender") +
  theme_minimal(base_size = 12) +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold", size = 14),
    legend.position = "top")

4. Screen Time and Happiness by Gender

Key Findings:

  • Both genders show similar negative trends between screen time and happiness
  • Slightly steeper slope for females (greater sensitivity to screen overuse)
  • Regardless of gender, more screen time predicts lower happiness

Statistical Analysis - Linear Regression

## 
## Call:
## lm(formula = Happiness_Index ~ Screen_Time + Sleep_Quality + 
##     Stress_Level + Exercise_Frequency + Age + Gender, data = clean_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.77103 -0.59049  0.00298  0.64588  2.44501 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         9.709293   0.491791  19.743  < 2e-16 ***
## Screen_Time        -0.104153   0.044325  -2.350   0.0192 *  
## Sleep_Quality       0.316585   0.041327   7.661 9.91e-14 ***
## Stress_Level       -0.458591   0.039700 -11.551  < 2e-16 ***
## Exercise_Frequency  0.009757   0.029043   0.336   0.7370    
## Age                 0.007399   0.004137   1.788   0.0744 .  
## GenderMale          0.001889   0.083925   0.023   0.9820    
## GenderOther         0.282445   0.201289   1.403   0.1612    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9145 on 492 degrees of freedom
## Multiple R-squared:  0.6451, Adjusted R-squared:   0.64 
## F-statistic: 127.7 on 7 and 492 DF,  p-value: < 2.2e-16

Statistical Analysis - Linear Regression

Model Summary: Statistically significant (F-test p < 0.001, R² = 0.645)

Significant Predictors:

  • Screen Time: β = -0.10, p = 0.019 - Higher screen time means lower happiness
  • Sleep Quality: β = 0.32, p < 0.001 - Better sleep means higher happiness
  • Stress Level: β = -0.46, p < 0.001 - Higher stress means lower happiness
  • Non-significant: Exercise, Age, Gender

The regression model showed a statistically significant relationship between happiness and several lifestyle factors (p < 0.001). Higher screen time and stress were both associated with lower happiness, while better sleep quality predicted higher happiness, which explains 64.5% of variance in happiness scores. Exercise, age, and gender did not have significant effects.

Conclusion

From the visualizations and statistical analysis, there is a statistically significant relationship between healthy social media habits and mental health. The results show that higher screen time is associated with greater stress and lower happiness, while better sleep quality improves happiness. Exercise frequency increases sleep quality but has a smaller impact on it. Platform usage differs across age groups. Overall, the findings suggest that maintaining healthy routines and adequate rest are key factors for improving happiness and mental health.