Data Set
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
male <- dat$Beats[dat$Sex == 1]
female <- dat$Beats[dat$Sex == 2]
Male vs Female
Descriptive Stats
summary(male)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 58.00 70.00 73.00 73.37 78.00 86.00
sd(male)
## [1] 5.875184
summary(female)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 68.00 76.00 74.15 80.00 89.00
sd(female)
## [1] 8.105227
Interpretation
From the
descriptive stats, it appears that females in the sample tended to have
higher heart rates (based on higher mean) and more variation compared to
the males in the sample.
Histogram and Normal
Probability Plots: Male vs Female
par(mfrow = c(2,2))
hist(male, main="Histogram: Resting Heart Rate (Males)", xlab="Beats per minute", col="blue")
qqnorm(male, main="Normal Probability Plot (Males)")
qqline(male, col="red")
hist(female, main="Histogram: Resting Heart Rate (Females)", xlab="Beats per minute", col="pink")
qqnorm(female, main="Normal Probability Plot (Females)")
qqline(female, col="red")


Interpretation
The histograms show
that male heart rates cluster around low 70s, while females show
clustering above 75. The QQ plots show that male show low variability,
while females show more variation at lower and higher ends.
Box Plot: Male vs
Female
par(mfrow = c(1,1))
boxplot(Beats ~ Sex, data=dat, names=c("Male","Female"), col=c("blue","pink"), main="Resting Heart Rate by Sex")


Interpretation
The box plots show
that the median female heart rate is higher that the male median. The
larger female box signifies higher variation.
Complete R Code
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
male <- dat$Beats[dat$Sex == 1]
female <- dat$Beats[dat$Sex == 2]
summary(male)
sd(male)
summary(female)
sd(female)
par(mfrow = c(2,2))
hist(male, main="Male HR", xlab="Beats", col="blue")
qqnorm(male)
qqline(male, col="red")
hist(female, main="Female HR", xlab="Beats", col="pink")
qqnorm(female)
qqline(female, col="red")
par(mfrow = c(1,1))
boxplot(Beats ~ Sex, data=dat, names=c("Male","Female"), col=c("blue","pink"), main="Resting Heart Rate by Sex")