This report contained a separate descriptive analysis of some male and female resting heart rate sample, and the comparison between them. The descriptive analysis will consist of minimal value, maximal value, quantiles, mean and standard deviation. Comparison will be based on the box plot.
To begin the analysis, we import the data set into R.
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
From 65 samples of male resting heart rate data, the analysis revealed a mean resting heart rate of 73.37 bpm with a standard deviation of 5.87 bpm. The heart rates ranged from a minimum of 58 bpm to a maximum of 86 bpm. Based on the quartiles, the middle 50% of the observations fell between the first quartile (Q1) of 70 bpm and the third quartile (Q3) of 78 bpm.
## Min Q1.25% Median Mean Std_dev Q3.75% Max
## 58.000000 70.000000 73.000000 73.369231 5.875184 78.000000 86.000000
From the histogram and normal probability plot, the distribution appears to have a bell-shaped pattern, with the observations falling closely along the normal distribution reference line. Therefore, the sample can reasonably be assumed to be approximately normally distributed, but need further testing.
From 65 samples of female resting heart rate data, the analysis revealed a mean resting heart rate of 74.15 bpm with a standard deviation of 8.11 bpm. The heart rates ranged from a minimum of 57 bpm to a maximum of 89 bpm. Based on the quartiles, the middle 50% of the observations fell between the first quartile (Q1) of 68 bpm and the third quartile (Q3) of 80 bpm.
## Min Q1.25% Median Mean Std_dev Q3.75% Max
## 57.000000 68.000000 76.000000 74.153846 8.105227 80.000000 89.000000
From the histogram and normal probability plot, the distribution appears to have a bell-shaped pattern, with the observations falling closely along the normal distribution reference line. Therefore, the sample can reasonably be assumed to be approximately normally distributed, but need further testing.
The box plot revealed some key insights of the sample data. First, there are no outliers found in both male and female data. Second, the median of female heart rate is higher than male. Finally, the interquartile range of female data is wider than the male, indicating greater variability in female heart rate.
Below are the complete R Code used for building this report.
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
#male descriptive and histogram
desc_male <- c(
Min = min(dat$Beats[dat$Sex == 1]),
Q1 = quantile(dat$Beats[dat$Sex == 1], 0.25),
Median = median(dat$Beats[dat$Sex == 1]),
Mean = mean(dat$Beats[dat$Sex == 1]),
Std_dev = sd(dat$Beats[dat$Sex == 1]),
Q3 = quantile(dat$Beats[dat$Sex == 1], 0.75),
Max = max(dat$Beats[dat$Sex == 1])
)
desc_male
#histogram and normal prob plot male
par(mfrow = c(1,2))
hist(dat$Beats[dat$Sex == 1],
main = "Histogram",
xlab = "Resting Heart Rate (bpm)",
col = "skyblue",
labels = T,
ylim = c(0,25)
)
qqnorm(dat$Beats[dat$Sex == 1],
main = "Normal Probability Plot")
qqline(dat$Beats[dat$Sex == 1],
col = "blue")
#female descriptive and histogram
desc_female <- c(
Min = min(dat$Beats[dat$Sex == 2]),
Q1 = quantile(dat$Beats[dat$Sex == 2], 0.25),
Median = median(dat$Beats[dat$Sex == 2]),
Mean = mean(dat$Beats[dat$Sex == 2]),
Std_dev = sd(dat$Beats[dat$Sex == 2]),
Q3 = quantile(dat$Beats[dat$Sex == 2], 0.75),
Max = max(dat$Beats[dat$Sex == 2])
)
desc_female
#histogram and normal prob plot female
par(mfrow = c(1,2))
hist(dat$Beats[dat$Sex == 2],
main = "Histogram",
xlab = "Resting Heart Rate (bpm)",
col = "pink",
labels = T,
ylim = c(0,20)
)
qqnorm(dat$Beats[dat$Sex == 1],
main = "Normal Probability Plot")
qqline(dat$Beats[dat$Sex == 1],
col = "red")
#side by side box plots
boxplot(dat$Beats[dat$Sex == 1], dat$Beats[dat$Sex ==2],
names = c("Male", "Female"),
col = c("skyblue", "pink"),
main = "Box Plots of Resting Heart Rate Between Male and Female",
xlab = "Gender",
ylab = "Resting Heart Rate")