1 Reading Data

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

dat$Sex <- as.factor(dat$Sex)

male <- dat[dat$Sex==1,]
female <- dat[dat$Sex==2,]

2 Data Analysis

2.1 Male Statistics

Histograms plots shows that male temperatures mean is around 98, which is supported by the descriptive statistics of 98.1 for the mean value. The first quartile has a value of 97.6 and the third quartile, 98.6. with a difference of 1 between quartiles. Moreover, since the n>40, we may assume that the temperature distribution is normal. This can be confirmed in the NPP. Same is valid for the heart beat distribution.

Heart beats displayed a higher variance when compared to the temperature for the sample population as we can see from the values for the first (70.0) and third quadrant(78.0) with a mean value of 73.37. Moreover, the NPP for the heart beat seems to have a linear tendency, which suggests normality.

#Males
summary(male$Temp)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    96.3    97.6    98.1    98.1    98.6    99.5
summary(male$Beats)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   58.00   70.00   73.00   73.37   78.00   86.00
Standard_Deviation_Temperature <- sd(male$Temp)
Standard_Deviation_Temperature
## [1] 0.6987558
Standard_Deviation_Beats <- sd(male$Beats)
Standard_Deviation_Beats
## [1] 5.875184
hist(male$Temp,main="Male Histogram of Temperature", xlab="Temperature",col="blue")

qqnorm(male$Temp,main="Male NPP of Temperature", ylab="Temperature",col="blue")

hist(male$Beats,main="Male Histogram of Beats", xlab="Beats",col="blue")

qqnorm(male$Beats,main="Male NPP of Beats", ylab="Beats",col="blue")

2.2 Female Statistics

Female histogram temperatures displayed a little higher temperatures when compared to males. This is supported by the descriptive statistics of 98.34 mean value for the female population. The first quartile for females is 98.00 and the third, 98.80 with a difference between quartiles of 0.8.

Female heart beats showed a higher mean value (74.15) compared to male (73.37) and also higher differences between the first quartile (68) and third quartile (80). Moreover, female heart beat histogram seems to be a little skewed to the right while male heart beat histogram looks more normal distributed. The NPP female plot also suggests that the points is not as linear distributed as it was for males.

#Females
summary(female$Temp)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   96.40   98.00   98.40   98.39   98.80  100.80
summary(female$Beats)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   57.00   68.00   76.00   74.15   80.00   89.00
Female_Standard_Deviation_Temperature <- sd(female$Temp)
Female_Standard_Deviation_Temperature
## [1] 0.7434878
Female_Standard_Deviation_Beats <- sd(female$Beats)
Female_Standard_Deviation_Beats
## [1] 8.105227
hist(female$Temp,main="Female Histogram of Temperature", xlab="Temperature",col="pink")

qqnorm(female$Temp,main="Female NPP of Temperature", ylab="Temperature",col="pink")

hist(female$Beats,main="Female Histogram of Beats", xlab="Beats",col="pink")

qqnorm(female$Beats,main="Female NPP of Beats", ylab="Beats",col="pink")

2.3 Comparison

Female heart beat distribution displayed a slightly higher scattered data compared to males. The median values for males seems to be slightly lower than females and the variance seems to be pretty close. Therefore, we may assume that a t-test with similar variance can be performed to test the hypotheses of equal mean for example. Both maximum and minimum values for females displayed higher and lower values respectively.

boxplot(male$Beats,female$Beats, names=c("Male","Female"),col=c("blue","pink"),main="Boxplot of resting heart rate for males and females",ylab="Heart Rate (bpm)")

3 Complete R Code

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

dat$Sex <- as.factor(dat$Sex)

male <- dat[dat$Sex==1,]
female <- dat[dat$Sex==2,]


#Males
summary(male$Temp)
summary(male$Beats)
Standard_Deviation_Temperature <- sd(male$Temp)
Standard_Deviation_Beats <- sd(male$Beats)
hist(male$Temp,main="Male Histogram of Temperature", xlab="Temperature",col="blue")
qqnorm(male$Temp,main="Male NPP of Temperature", ylab="Temperature",col="blue")

hist(male$Beats,main="Male Histogram of Beats", xlab="Beats",col="blue")
qqnorm(male$Beats,main="Male NPP of Beats", ylab="Beats",col="blue")



#Females
summary(female$Temp)
summary(female$Beats)
Female_Standard_Deviation_Temperature <- sd(female$Temp)
Female_Standard_Deviation_Beats <- sd(female$Beats)
hist(female$Temp,main="Female Histogram of Temperature", xlab="Temperature",col="pink")
qqnorm(female$Temp,main="Female NPP of Temperature", ylab="Temperature",col="pink")
hist(female$Beats,main="Female Histogram of Beats", xlab="Beats",col="pink")
qqnorm(female$Beats,main="Female NPP of Beats", ylab="Beats",col="pink")



boxplot(male$Beats,female$Beats, names=c("Male","Female"),col=c("blue","pink"),main="Boxplot of resting heart rate for males and females",ylab="Heart Rate (bpm)")