Dataset

https://www.kaggle.com/datasets/catherinerasgaitis/mxmh-survey-results

Description

This dataset delves into the relationship between music and its impact on mental well-being. It includes columns that provide information on individuals’ music preferences and whether they perceive any influence on their mental state. As I approach this dataset, I aim to explore the following questions: Does the tempo (bpm) of the music being listened to have an impact on mental health? What age demographics are engaged with this music? And is there a connection between the duration of music listening and mental health?

Loading Data Into R

#setwd("C:/Users/janet/Donloads/archive")
read.data <- read.csv("mxmh_survey_results.csv")
#read.data

The histogram exhibits a rightward skew, indicating that a larger portion of the population listens to a relatively lower amount of music daily compared to those who engage in longer music listening sessions. ## Hours Spent Listening To Music Plot

hist(read.data$Hours.per.day, xlab="Hours Listened", ylab = "Amount of People Listening",main="Hours Spent Listening To Music", col="green")

The box plot exhibits a rightward skew, signifying that there is a larger representation of younger individuals in the survey who are willing to discuss their mental health, while the participation from older age groups is comparatively lower. ## Age Range of Those Being Surveyed Plot

boxplot(read.data$Age, main="Age Range", ylab="Age", col="red")

The histogram illustrates a normal distribution, indicating that the majority of music listeners have a preference for music within a similar range of beats per minute (bpm). ## BPM of Favorite Genre Plot

bpm <- as.factor(read.data$BPM)
hist(as.numeric(bpm), main="BPM of Favorite Genre", xlab="BPM", ylab="Amount of People", col="cyan")

These calculations provide statistics such as the mean, median, standard deviation, and more for the ages of the individuals included in the survey. ## Statistical Calculations on Hours listened per day

mean(read.data$Hours.per.day)
## [1] 3.572758
sd(read.data$Hours.per.day)
## [1] 3.028199
median(read.data$Hours.per.day)
## [1] 3
min(read.data$Hours.per.day)
## [1] 0
max(read.data$Hours.per.day)
## [1] 24

I conducted separate t-tests on the data I wanted to explore further, enabling me to make meaningful comparisons between them.This process will contribute to enhancing my comprehension of how music influences mental health. ## T-Test on Hours listened per day

t.test(read.data$Hours.per.day, mu=3)
## 
##  One Sample t-test
## 
## data:  read.data$Hours.per.day
## t = 5.1313, df = 735, p-value = 3.686e-07
## alternative hypothesis: true mean is not equal to 3
## 95 percent confidence interval:
##  3.353624 3.791892
## sample estimates:
## mean of x 
##  3.572758

T-Test on BPM

t.test(read.data$BPM, mu=130)
## 
##  One Sample t-test
## 
## data:  read.data$BPM
## t = 1, df = 628, p-value = 0.3177
## alternative hypothesis: true mean is not equal to 130
## 95 percent confidence interval:
##  -1532068  4711965
## sample estimates:
## mean of x 
##   1589948

T-Test on Age

t.test(read.data$Age, mu=20)
## 
##  One Sample t-test
## 
## data:  read.data$Age
## t = 11.71, df = 734, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 20
## 95 percent confidence interval:
##  24.33386 26.07975
## sample estimates:
## mean of x 
##   25.2068