For males, perform an analysis that includes the descriptive statistics (e.g. min, max, sample mean, sample standard deviation, sample median, quartiles), histogram, and normal probability plot. Comment on the statistics and plots. Repeat the same for females. Be sure to uniquely label the title and x-axis, and color the histograms (male-blue, female-pink).
Create side by side box plots that compare the resting heart rate of males and females. Be sure to title and label (male/female) the box plots. Comment on what you see in the box plots (similarities and/or differences).
library(ggplot2)
library(summarytools)
dat<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
male<-dat[dat$Sex==1,]
descr(male$Beats)
## Descriptive Statistics
## male$Beats
## N: 65
##
## Beats
## ----------------- --------
## Mean 73.37
## Std.Dev 5.88
## Min 58.00
## Q1 70.00
## Median 73.00
## Q3 78.00
## Max 86.00
## MAD 5.93
## IQR 8.00
## CV 0.08
## Skewness -0.05
## SE.Skewness 0.30
## Kurtosis -0.47
## N.Valid 65.00
## Pct.Valid 100.00
# With 65 male participants,the average heart beats per minute was 73.37 with a standard deviation of 5.88 for the male participants in the experimental study. The male with the lowest heart beat of 58 beats had a stable temperature of 97 degrees Fahrenheit. The highest heart beat of 86 beats had a temperature of 98 degrees Fahrenheit. From this an assumption, can be made that temperature does not have a major impact on heart beats.
hist(male$Beats,main="Histogram of Male Resting Heartbeats",xlab ="Heartbeat", ylab="Count",col="blue4",border="chartreuse3")
# According to the histogram, the male resting heart beat participant responses are highest between heartbeat 70-75.
ggplot(male, aes(sample = Beats)) +
stat_qq() +
geom_qq(color = "royal blue") +
labs(title = "Normal Probability Plot of Male Heartbeats", x = "Quantile", y = "Heartbeat")
# The normal probability plot of the male heartbeats shows that there are no extreme outliers. There are two outliers on the plot, but the skew is -0.05.
female<-dat[dat$Sex==2,]
descr(female$Beats)
## Descriptive Statistics
## female$Beats
## N: 65
##
## Beats
## ----------------- --------
## Mean 74.15
## Std.Dev 8.11
## Min 57.00
## Q1 68.00
## Median 76.00
## Q3 80.00
## Max 89.00
## MAD 8.90
## IQR 12.00
## CV 0.11
## Skewness -0.28
## SE.Skewness 0.30
## Kurtosis -0.82
## N.Valid 65.00
## Pct.Valid 100.00
# With 65 female participants,the average heart beats per minute was 74.15 with a standard deviation of 8.11 for the female participants in the experimental study. The female with the lowest heart beat of 57 beats had a stable temperature of 97 degrees farenheit. The highest heart beat of 89 beats had a temperature of 98 degrees ferenheit. From this an assumption, can be made that temperature does not have a major impact on heart beats.
hist(female$Beats,main="Histogram of Female Resting Heartbeats",xlab ="Heartbeat",ylab="Count",col="pink2",border="black")
# According to the histogram, the female resting heart beat participant responses are highest between heartbeat 75-80.
ggplot(female, aes(sample = Beats)) +
stat_qq() +
geom_qq(color = "pink3") +
labs(title = "Normal Probability Plot of Male Heartbeats", x = "Quantile", y = "Heartbeat")
# The normal probability plot of the male heartbeats shows that there are no extreme outliers. There are two outliers on the plot, but the skew is -0.28.
Comment on Normal Probability Plot Here.
label=c("Female","Male")
boxplot(female$Beats,male$Beats,main="Boxplots of Female and Male Heartbeats", ylab="Heartbeat",col= rainbow (2), border="black", names=label)
# The female heartbeats exhibit more range in response than the male heartbeats.
# Male average resting heartbeat (73.37) is typically lower than Female average resting heartbeat (74.15).
#Additionally, the temperatures of the lowest and highest heartbeats for men and women were the same. From this, we can assume and present a research opportunity for temperature stuides of how have a stable temperature versus a fever may affect one's heartrate.
# Question 1
library(ggplot2)
library(summarytools)
dat<-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
# Male
male<-dat[dat$Sex==1,]
descr(male$Beats)
## Histogram of Male Heartbeats
hist(male$Beats,main="Histogram of Male Resting Heartbeats",xlab ="Heartbeat",ylab="Count",col="blue4",border="chartreuse3")
## Normal Probability Plot of Male Heartbeats
ggplot(male, aes(sample = Beats)) +
stat_qq() +
geom_qq(color = "royal blue") +
labs(title = "Normal Probability Plot of Male Heartbeats", x = "Quantile", y = "Heartbeat")
# Female
female<-dat[dat$Sex==2,]
descr(female$Beats)
## Histogram of Female Heartbeats
hist(female$Beats,main="Histogram of Female Resting Heartbeats",xlab ="Heartbeat",ylab="Count",col="pink2",border="black")
## Normal Probability Plot of Female Heartbeats
ggplot(female, aes(sample = Beats)) +
stat_qq() +
geom_qq(color = "pink3") +
labs(title = "Normal Probability Plot of Male Heartbeats", x = "Quantile", y = "Heartbeat")
# Boxplots
label=c("Female","Male")
boxplot(female$Beats,male$Beats,main="Boxplots of Female and Male Heartbeats", ylab="Heartbeat",col= rainbow (2), border="black", names=label)