dat<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
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)
mdata<-dat[dat$Sex==1,]
sd(mdata$Beats)
## [1] 5.875184
summary(mdata$Beats)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 58.00 70.00 73.00 73.37 78.00 86.00
Comment: From the data we can see the male’s minimum heartbeat is 58 & the maximum is 86. Standard Deviation is 5.8752.
Histogram & Normal Probability Plot
hist(mdata$Beats,col="blue",xlab="Heartbeat",main="Male's Heartbeat Histogram")
qqnorm(mdata$Beats,main="Male's Heartbeat Normal Plot",col="blue")
qqline(mdata$Beats,col="green")
Comment: The Histogram shows that, it’s a normal distribution with most data s are centered around 70-75. The normal probability plot shows a linear graph with most data between theoretical quantile -1 to 1.
fdata<-dat[dat$Sex==2,]
sd(fdata$Beats)
## [1] 8.105227
summary(fdata$Beats)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 68.00 76.00 74.15 80.00 89.00
Comment: The minimum heartbeat is 57 and meximum is 89 for Female sample. The standard deviation is 8.1052.
Histogram & Normal Probability Plot
hist(fdata$Beats,col="pink",xlab="Heartbeat",main="Female's Heartbeat Histogram")
qqnorm(fdata$Beats,main="Female's Heartbeat Normal Plot",col="pink")
qqline(mdata$Beats,col="red")
Comment: The Histogram shows that, it’s a right skewed normal distribution with most data’s are centered around 75-80. The normal probability plot shows a linear graph with most data between theoretical quantile -1 to 1.
boxplot(mdata$Beats,fdata$Beats,names=c("Male", "Female"),col=c("blue","pink"))
From the box plot we get-
Males standard deviation is lower than the females.
Median of female sample is higher than the males.
Female sample data is more spread out than males
In conclusion the sample of resting heartbeat shows that, females have higher resting heartbeat compared to the males.
# Read Data from CSV
dat<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
str(dat)
dat$Sex<-as.factor(dat$Sex)
# Male sample Heartbeat
mdata<-dat[dat$Sex==1,]
sd(mdata$Beats)
summary(mdata$Beats)
hist(mdata$Beats,col="blue",xlab="Heartbeat",main="Male's Heartbeat Histogram")
qqnorm(mdata$Beats,main="Male's Heartbeat Normal Plot",col="blue")
qqline(mdata$Beats,col="green")
#Female smaple Heartbeat
fdata<-dat[dat$Sex==2,]
sd(fdata$Beats)
summary(fdata$Beats)
hist(fdata$Beats,col="pink",xlab="Heartbeat",main="Female's Heartbeat Histogram")
qqnorm(fdata$Beats,main="Female's Heartbeat Normal Plot",col="pink")
qqline(mdata$Beats,col="red")
#Box Plot
boxplot(mdata$Beats,fdata$Beats,names=c("Male", "Female"),col=c("blue","pink"))