For this Flip Assigment, we need to download the .csv file into a variable and separate the data in terms of sex
The code below shows how to do it:
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
dat_male <- dat[1:65,]
dat_fem <- dat[66:130,]
The code below prints the descriptive statistics:
print(min(dat_male$Beats))
## [1] 58
print(max(dat_male$Beats))
## [1] 86
print(mean(dat_male$Beats))
## [1] 73.36923
print(sd(dat_male$Beats))
## [1] 5.875184
print(median(dat_male$Beats))
## [1] 73
print(quantile(dat_male$Beats))
## 0% 25% 50% 75% 100%
## 58 70 73 78 86
hist(dat_male$Beats
,main="Male Resting Beats"
,col="blue"
,xlab="Resting Beats")
qqnorm(dat_male$Beats,
main="Male Resting Beats Norm Plot",
xlab="Normal Quantities",
ylab="Heart Beats")
print(min(dat_fem$Beats))
## [1] 57
print(max(dat_fem$Beats))
## [1] 89
print(mean(dat_fem$Beats))
## [1] 74.15385
print(sd(dat_fem$Beats))
## [1] 8.105227
print(median(dat_fem$Beats))
## [1] 76
print(quantile(dat_fem$Beats))
## 0% 25% 50% 75% 100%
## 57 68 76 80 89
hist(dat_fem$Beats
,main="Female Resting Beats"
,col="pink"
,xlab="Resting Beats")
qqnorm(dat_fem$Beats,
main="Female Resting Beats Norm Plot",
xlab="Normal Quantities",
ylab="Heart Beats")
boxplot(dat_male$Beats, dat_fem$Beats,
names=c("Male","Female"),
main="Side-by-side boxplots")
The table below shows the comparison between the values that we were able to get from the collected data:
Statistics | Males | Females |
---|---|---|
Minimum | 58 | 57 |
Maximum | 86 | 89 |
Mean | 73.37 | 74.15 |
Std Dev | 5.87 | 8.10 |
Median | 73 | 76 |
Males Quartiles
## 0% 25% 50% 75% 100%
## 58 70 73 78 86
Female Quartiles
## 0% 25% 50% 75% 100%
## 57 68 76 80 89
When comparing the descriptive statistics, Females present higher maximum values and lower minimum values, 89 and 57 BPM respectively, besides a higher median, 76 BPM. However, it is important to state that the difference between minimum values between males and females is not that high (1 BPM of difference).
Considering the mean and std values, it is not possible see a huge difference between means, but females present higher STD values, of 8.10 BPM.
All these information are well summarized in the box plot. Where it is possible to see that the std and maximum values discrepancies, by checking the difference in height of the box and the upper whisker, respectively.
Regarding the normal plots, it is possible to conclude that both data are approximately normal, because they almost follow a line. But, when we look at the histogram of female subjects, this conclusion does not appear to be correct, differently for males.
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
dat_male <- dat[1:65,]
dat_fem <- dat[66:130,]
#-------------- Male Data
print(min(dat_male$Beats))
print(max(dat_male$Beats))
print(mean(dat_male$Beats))
print(sd(dat_male$Beats))
print(median(dat_male$Beats))
print(quantile(dat_male$Beats))
hist(dat_male$Beats
,main="Male Resting Beats"
,col="green"
,xlab="Resting Beats")
qqnorm(dat_male$Beats,
main="Male Beats Normal Distribution",
xlab="Normal Quantities",
ylab="Heart Beats")
#-------------- Female Data
print(min(dat_fem$Beats))
print(max(dat_fem$Beats))
print(mean(dat_fem$Beats))
print(sd(dat_fem$Beats))
print(median(dat_fem$Beats))
print(quantile(dat_fem$Beats))
hist(dat_fem$Beats
,main="Female Resting Beats"
,col="pink"
,xlab="Resting Beats")
qqnorm(dat_fem$Beats,
main="Female Beats Normal Distribution",
xlab="Normal Quantities",
ylab="Heart Beats")
#-------------- Box Plots
boxplot(dat_male$Beats, dat_fem$Beats,
names=c("Male","Female"),
main="Side-by-side boxplots")