Load Data

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

Analyze male resting heart rate

male <- normtemp$Beats[normtemp$Sex == 1]

min(male)
## [1] 58
max(male)
## [1] 86
mean(male)
## [1] 73.36923
sd(male)
## [1] 5.875184
median(male)
## [1] 73
quantile(male)
##   0%  25%  50%  75% 100% 
##   58   70   73   78   86

Male Histogram

hist(male,
    main = "Histogram of Male Resting Heart Rate",
    xlab = "Resting Heart Rate (BPM)",
    col = "blue")

Male Normal Probability Plot

qqnorm(male,
       main = "Normal Probability Plot of Male Resting Heart Rate",
       xlab = "Theoretical Quantiles",
       ylab = "Male Resting Heart Rate (BPM)")

qqline(male)

Male Comments

The male resting heart rates range from 58 to 86 bpm, the mean is about 73.369 bpm, the standard deviation is about 5.875 bpm, and the median is 73 bpm. The first and third quartiles are 70 and 78 bpm, respectively. This shows the data to be fairly symmetric. The histogram also shows an approximately symmetric distribution. The observations in the normal probability plot mostly follow the reference line, suggesting that male resting heart rates are approximately normally distributed.

Analyze female resting heart rates

female <- normtemp$Beats[normtemp$Sex == 2]

min(female)
## [1] 57
max(female)
## [1] 89
mean(female)
## [1] 74.15385
sd(female)
## [1] 8.105227
median(female)
## [1] 76
quantile(female)
##   0%  25%  50%  75% 100% 
##   57   68   76   80   89

Female Histogram

hist(female,
    main = "Histogram of Female Resting Heart Rate",
    xlab = "Resting Heart Rate (BPM)",
    col = "pink")

Female Normal Probability Plot

qqnorm(female,
       main = "Normal Probability Plot of Female Resting Heart Rate",
       xlab = "Theoretical Quantiles",
       ylab = "Female Resting Heart Rate (BPM)")

qqline(female)

Female Comments

The female resting heart rates range from 57 to 89 bpm, the mean is about 74.154 bpm, the standard deviation is about 8.105 bpm, and the median is 76 bpm. The first and third quartiles are 68 and 80 bpm, respectively. The mean being lower than the median shows the data to have some slight left skewness. The histogram also shows a slight left skew. However, the observations in the normal probability plot mostly follow the reference line, suggesting that female resting heart rates are approximately normally distributed with asymmetry at the tails.

Comparison of Male and Female Resting Heart Rates

Side-by-Side Boxplots

boxplot(male, female,
        names = c("Male","Female"),
        main = "Resting Heart Rate by Sex",
        ylab = "Resting Heart Rate (BPM)")

Boxplot Comments

The boxplots show that the resting heart rates of males and females have similar centers, but females have a slightly higher median heart rate (76 bpm) compared to males (73 bpm). The female heart rates also show greater variability, shown by the larger interquartile range and overall spread. Neither group has apparent outliers.

Complete R Code

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

male <- normtemp$Beats[normtemp$Sex == 1]

min(male)
max(male)
mean(male)
sd(male)
median(male)
quantile(male)

hist(male,
    main = "Histogram of Male Resting Heart Rate",
    xlab = "Resting Heart Rate (BPM)",
    col = "blue")

qqnorm(male,
       main = "Normal Probability Plot of Male Resting Heart Rate",
       xlab = "Theoretical Quantiles",
       ylab = "Male Resting Heart Rate (BPM)")

qqline(male)

female <- normtemp$Beats[normtemp$Sex == 2]

min(female)
max(female)
mean(female)
sd(female)
median(female)
quantile(female)

hist(female,
    main = "Histogram of Female Resting Heart Rate",
    xlab = "Resting Heart Rate (BPM)",
    col = "pink")

qqnorm(female,
       main = "Normal Probability Plot of Female Resting Heart Rate",
       xlab = "Theoretical Quantiles",
       ylab = "Female Resting Heart Rate (BPM)")

qqline(female)

boxplot(male, female,
        names = c("Male","Female"),
        main = "Resting Heart Rate by Sex",
        ylab = "Resting Heart Rate (BPM)")