Introduction

In this analysis, we examine the resting heart rates of 65 randomly sampled males and females and present the results.

Loading and Preparing the Data

normtemp <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")

hr_male <- normtemp$Beats[normtemp$Sex == 1]
hr_female <- normtemp$Beats[normtemp$Sex == 2]

I.) Male Resting Heart Rate

1.) Descriptive Statistics

From the given data we can see that the male resting heart rates have a mean of approximately 73 BPM. Since the mean and median are similar, we can also infer that there is an approximately symmetric distribution.

c(
  Minimum = min(hr_male),
  Maximum = max(hr_male),
  Mean = mean(hr_male),
  Standard_Deviation = sd(hr_male),
  Median = median(hr_male),
  Q1 = quantile(hr_male, 0.25),
  Q3 = quantile(hr_male, 0.75)
)
##            Minimum            Maximum               Mean Standard_Deviation 
##          58.000000          86.000000          73.369231           5.875184 
##             Median             Q1.25%             Q3.75% 
##          73.000000          70.000000          78.000000

2.) Histogram

The histogram is approximately symmetric, with most heart rates around 70 BPM.

hist(
  hr_male,
  main = "Histogram of Male Resting Heart Rates",
  xlab = "Resting Heart Rate (in BPM)",
  ylab = "Frequency",
  col = "blue",
  
)

3.) Normal Probability Plot

Here most points are close to the line, which implies the male heart rate to be approximately normal.

qqnorm(
  hr_male,
  main = "Normal Probability Plot of Male Resting Heart Rates",
  xlab = "Quantile Range",
  ylab = "Male Resting Heart Rate (in BPM)",
  col = "blue"
)

qqline(hr_male)

II.) Female Resting Heart Rate

1.) Descriptive Statistics

c(
  Minimum = min(hr_female),
  Maximum = max(hr_female),
  Mean = mean(hr_female),
  Standard_Deviation = sd(hr_female),
  Median = median(hr_female),
  Q1 = quantile(hr_female, 0.25),
  Q3 = quantile(hr_female, 0.75)
)
##            Minimum            Maximum               Mean Standard_Deviation 
##          57.000000          89.000000          74.153846           8.105227 
##             Median             Q1.25%             Q3.75% 
##          76.000000          68.000000          80.000000

The female heart rates have a mean of approximately 74 beats per minute. They have more variability than the male heart rates.

2.) Histogram

The female heart rates are more spread out but remain approximately symmetric.

hist(
  hr_female,
  main = "Histogram of Female Resting Heart Rates",
  xlab = "Resting Heart Rate (in BPM)",
  ylab = "Frequency",
  col = "pink",
  
)

3.) Normal Probability Plot

Most points are near the line, with some deviation at the ends.

qqnorm(
  hr_female,
  main = "Normal Probability Plot of Female Resting Heart Rates",
  xlab = "Quantile Range",
  ylab = "Female Resting Heart Rate (in BPM)",
  col = "pink"
)

qqline(hr_female)

III.) Side-by-Side Box Plots

We can see that females have a slightly higher median and greater variability than males

boxplot(
  hr_male,
  hr_female,
  names = c("Male", "Female"),
  main = "Male and Female Resting Heart Rates",
  xlab = "Sex",
  ylab = "Resting Heart Rate (in BPM)",
  col = c("blue", "pink")
)

Complete R Code

normtemp <- read.csv(
  "https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv"
)

hr_male <- normtemp$Beats[normtemp$Sex == 1]
hr_female <- normtemp$Beats[normtemp$Sex == 2]

c(
  Minimum = min(hr_male),
  Maximum = max(hr_male),
  Mean = mean(hr_male),
  Standard_Deviation = sd(hr_male),
  Median = median(hr_male),
  Q1 = quantile(hr_male, 0.25),
  Q3 = quantile(hr_male, 0.75)
)

hist(
  hr_male,
  main = "Histogram of Male Resting Heart Rates",
  xlab = "Resting Heart Rate (in BPM)",
  ylab = "Frequency",
  col = "blue",
  
)

qqnorm(
  hr_male,
  main = "Normal Probability Plot of Male Resting Heart Rates",
  xlab = "Quantile Range",
  ylab = "Male Resting Heart Rate (in BPM)",
  col = "blue"
)

qqline(hr_male)

c(
  Minimum = min(hr_female),
  Maximum = max(hr_female),
  Mean = mean(hr_female),
  Standard_Deviation = sd(hr_female),
  Median = median(hr_female),
  Q1 = quantile(hr_female, 0.25),
  Q3 = quantile(hr_female, 0.75)
)

hist(
  hr_female,
  main = "Histogram of Female Resting Heart Rates",
  xlab = "Resting Heart Rate (in BPM)",
  ylab = "Frequency",
  col = "pink",
  
)

qqnorm(
  hr_female,
  main = "Normal Probability Plot of Female Resing Heart Rates",
  xlab = "Quantile Range",
  ylab = "Female Resting Heart Rate (in BPM)",
  col = "pink"
)

qqline(hr_female)

boxplot(
  hr_male,
  hr_female,
  names = c("Male", "Female"),
  main = "Male and Female Resting Heart Rates",
  xlab = "Sex",
  ylab = "Resting Heart Rate (BPM)",
  col = c("blue", "pink")
)