Reading the data
dat<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
head(dat)
## ï..Temp Sex Beats
## 1 96.3 1 70
## 2 96.7 1 71
## 3 96.9 1 74
## 4 97.0 1 80
## 5 97.1 1 73
## 6 97.1 1 75
colnames(dat)<-c("Temp","Sex","Beats")
head(dat)
## Temp Sex Beats
## 1 96.3 1 70
## 2 96.7 1 71
## 3 96.9 1 74
## 4 97.0 1 80
## 5 97.1 1 73
## 6 97.1 1 75
str(dat)
## 'data.frame': 130 obs. of 3 variables:
## $ Temp : num 96.3 96.7 96.9 97 97.1 97.1 97.1 97.2 97.3 97.4 ...
## $ Sex : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Beats: int 70 71 74 80 73 75 82 64 69 70 ...
dat$Sex<-as.factor(dat$Sex)
str(dat)
## 'data.frame': 130 obs. of 3 variables:
## $ Temp : num 96.3 96.7 96.9 97 97.1 97.1 97.1 97.2 97.3 97.4 ...
## $ Sex : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
## $ Beats: int 70 71 74 80 73 75 82 64 69 70 ...
malesdata<-dat[dat$Sex==1,]
summary(malesdata$Beats)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 58.00 70.00 73.00 73.37 78.00 86.00
sd(malesdata$Beats)
## [1] 5.875184
Comments: From above statistics on Resting Heartbeat of males, we can see that minimum is 58, maximum is 86, standard deviation is 5.8751841 and Sample mean is 73.37
hist(malesdata$Beats, main ="Males Heartbeats",col="blue", xlab="Males Heartbeats")
qqnorm(malesdata$Beats, main = "Males Heartbeat", col = "blue")
qqline(malesdata$Beats, col = "green")
Comments: For Histogram plot We have a normal probability histogram distribution which is centered around 70 and 75.
AND
For the QQ norm graph We have a linear relationship between sample quantiles and theoritical sample quantiles and maximum data is centered between -1 and 1.
femalesdata<-dat[dat$Sex==2,]
summary(femalesdata$Beats)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 68.00 76.00 74.15 80.00 89.00
sd(femalesdata$Beats)
## [1] 8.105227
Comments: From above statistics on Resting Heartbeat of females, we can see that minimum is 57, maximum is 89, standard deviation is 8.105227 and Sample mean is 74.15
hist(femalesdata$Beats, main ="Females Heartbeats",col="pink", xlab="Females Heartbeats")
qqnorm(femalesdata$Beats, main = "Females Heartbeat", col = "pink")
qqline(femalesdata$Beats, col = "black")
Comments: For Histogram plot lof female data We have a normal probability histogram distribution which is right skewed and maximum frequency lying around 75 and 80.
And
For the QQ norm graph We have a linear relationship between sample quantiles and theoritical sample quantiles and maximum data is centered between -1 and 1.
boxplot(malesdata$Beats,femalesdata$Beats,names=c("Males","Females"))
Comparison Analysis of Male of Female:
From the box plot shown the median for female is greater than that of male.
InterQuartile range of female is greater than that of male.
From the box plot the maximum for male and female are 86 and 89 respectively.
From the box plot the minimum for male and female are 58 and 57 respectively.
From the box plot we can see that both male and female box plot has reasonably close variance.
From the box plot female data looks a bit skewed because median is not at the center of the box.
From the box plot we see that the quartiles for male are close by to the median but for female it is a bit far away.
Conclusion: The average heart rates of male is little less than female heart rates based on the data obtained.