Lab report

Load data:

download.file("http://www.openintro.org/stat/data/bdims.RData", destfile = "bdims.RData")
load("bdims.RData")
head(bdims)
##   bia.di bii.di bit.di che.de che.di elb.di wri.di kne.di ank.di sho.gi che.gi
## 1   42.9   26.0   31.5   17.7   28.0   13.1   10.4   18.8   14.1  106.2   89.5
## 2   43.7   28.5   33.5   16.9   30.8   14.0   11.8   20.6   15.1  110.5   97.0
## 3   40.1   28.2   33.3   20.9   31.7   13.9   10.9   19.7   14.1  115.1   97.5
## 4   44.3   29.9   34.0   18.4   28.2   13.9   11.2   20.9   15.0  104.5   97.0
## 5   42.5   29.9   34.0   21.5   29.4   15.2   11.6   20.7   14.9  107.5   97.5
## 6   43.3   27.0   31.5   19.6   31.3   14.0   11.5   18.8   13.9  119.8   99.9
##   wai.gi nav.gi hip.gi thi.gi bic.gi for.gi kne.gi cal.gi ank.gi wri.gi age
## 1   71.5   74.5   93.5   51.5   32.5   26.0   34.5   36.5   23.5   16.5  21
## 2   79.0   86.5   94.8   51.5   34.4   28.0   36.5   37.5   24.5   17.0  23
## 3   83.2   82.9   95.0   57.3   33.4   28.8   37.0   37.3   21.9   16.9  28
## 4   77.8   78.8   94.0   53.0   31.0   26.2   37.0   34.8   23.0   16.6  23
## 5   80.0   82.5   98.5   55.4   32.0   28.4   37.7   38.6   24.4   18.0  22
## 6   82.5   80.1   95.3   57.5   33.0   28.0   36.6   36.1   23.5   16.9  21
##    wgt   hgt sex
## 1 65.6 174.0   1
## 2 71.8 175.3   1
## 3 80.7 193.5   1
## 4 72.6 186.5   1
## 5 78.8 187.2   1
## 6 74.8 181.5   1
mdims <- subset(bdims, sex == 1)
fdims <- subset(bdims, sex == 0)

Set a seed:

Exercises:

Exercise 1:

hist(mdims$hgt)

hist(fdims$hgt)

fhgtmean <- mean(fdims$hgt)
fhgtsd   <- sd(fdims$hgt)

hist(fdims$hgt, probability = TRUE, ylim = c(0, 0.06))
x <- 140:190
y <- dnorm(x = x, mean = fhgtmean, sd = fhgtsd)
lines(x = x, y = y, col = "blue")

While both male and female heights follow a normal distribution, male heights exhibit a slightly more symmetrical normal distribution compared to females. Notably, the distribution of female heights shows a slight right skew. Moreover, on average, males tend to be taller than females. Examining the peak of both distributions, the average height for males is 175 cm, whereas for females, it is 165 cm.

Exercise 2:

qqnorm(fdims$hgt)
qqline(fdims$hgt)

sim_norm <- rnorm(n = length(fdims$hgt), mean = fhgtmean, sd = fhgtsd)

Yes, based on this plot it looks like the female heights follow a nearly normal distribution.

Exercise 3:

qqnorm(sim_norm)
qqline(sim_norm)

qqnormsim(fdims$hgt)

’’’

Exercise 4:

Indeed, the simulated data plots exhibit fluctuations in the tails, mirroring the pattern observed in the female height data. Consequently, we can assert that our distributions of female heights closely resemble a normal distribution. #### Exercise 5:

hist(fdims$wgt)

fwgtmean <- mean(fdims$wgt)
fwgtsd   <- sd(fdims$wgt)

qqnorm(fdims$wgt)
qqline(fdims$wgt)

qqnormsim(fdims$wgt)

1 - pnorm(q = 182, mean = fhgtmean, sd = fhgtsd)
## [1] 0.004434387
sum(fdims$hgt > 182) / length(fdims$hgt)
## [1] 0.003846154

Prior to examining the normal probability plots, it’s evident that the weight distribution exhibits a pronounced right-skewness compared to the height data. The normal probability plot for weights reveals substantial deviations from the normal line, particularly at the tails of the data. The weight data diverges significantly from the patterns observed in the sample probability plots, leading us to conclude that it does not conform to a normal distribution. #### Exercise 6:

p160 <- pnorm(q = 161, mean = fhgtmean, sd = fhgtsd)
p165<- pnorm(q = 166, mean = fhgtmean, sd = fhgtsd)
p165 - p160
## [1] 0.29137
sum(fdims$hgt >= 160 & fdims$hgt <= 165) / length(fdims$hgt)
## [1] 0.3192308
1- pnorm(q = 50, mean = fwgtmean, sd = fwgtsd)
## [1] 0.864857
sum(fdims$wgt > 50) / length(fdims$wgt)
## [1] 0.8807692

On your own:

1:

1.1
hist(fdims$bii.di)

qqnorm(fdims$bii.di)
qqline(fdims$bii.di)

1.2
hist(fdims$elb.di)

qqnorm(fdims$bii.di)
qqline(fdims$bii.di)

1.3
hist(bdims$age)

qqnorm(bdims$age)
qqline(bdims$age)

1.4
hist(fdims$che.de)

qqnorm(fdims$che.de)
qqline(fdims$che.de)

2:

The probability plot C illustrates elbow diameter, while D depicts age. The distinct, step-like progression observed in the age variable arises from the discrete nature of the data, which was recorded at the integer level. Consequently, these apparent “steps” reflect the transitions between consecutive values. In contrast, elbow diameter, being non-discrete, exhibits a stepwise pattern likely due to the frequent recurrence of identical measurements, where multiple records share the same value. #### 3:

kneMean <- mean(fdims$kne.di)
kneSd <- sd(fdims$kne.di)
qqnorm(fdims$kne.di)
qqline(fdims$kne.di)

hist(fdims$kne.di)

Based on the normal probability plot, this variable appears to be right-skewed because the data diverges from the normal line at the right tail of the plot. The histogram confirms this.


Teamwork report

Team member Attendance Author Contribution %
Varun Pradhan Yes Yes 50%
Karsten Friebe Yes Yes 50%
Name of member 3 Yes / No Yes / No 0%
Name of member 4 Yes / No Yes / No 0%
Total 100%