Homework 3

Course

STAT218

Due

January 23, 2025

  1. The provided code splits the body temperature data into two groups by sex. Use this data to do the following.

    1. Compute a 90% confidence interval for the mean female body temperature and interpret the interval in context in the style introduced in class.
    2. Compute a 90% confidence interval for the mean male body temperature and interpret the interval in context in the style introduced in class.
    3. Based on your intervals, is it plausible that there is no difference in mean temperature by sex? Why or why not?
load('data/temps2.RData')

# split observations into two groups by sex
temps.split <- split(temps$body.temp, temps$sex)

# store male and female temperatures
temps.m <- temps.split$male
temps.f <- temps.split$female

# part a: confidence interval for mean body temps for female
temps.f.mean <- mean(temps.f)
temps.f.se <- sd(temps.f)/sqrt(65)
cval.f <- qt(0.95, df = 64)
temps.f.mean + cval.f*c(-1, 1)*temps.f.se
[1] 98.23993 98.54776
# part b: confidence interval for mean body temps for male
temps.m.mean <- mean(temps.m)
temps.m.se <- sd(temps.m)/sqrt(65)
cval.m <- qt(0.95, df = 64)
temps.m.mean + cval.m*c(-1, 1)*temps.m.se
[1] 97.95996 98.24927
  1. With 90% confidence, the mean female body temperature is estimated to be between 98.24 and 98.55 degrees Farenheit.
  2. With 90% confidence, the mean male body temperature is estimated to be between 97.96 and 98.24 degrees Farenheit.
  3. The intervals overlap, so there is a common plausible value for both means; it is therefore plausible that there is no difference is mean temperature by sex.
  1. The armspans dataset contains the 32 armspan measurements from last class.

    1. Construct a histogram of the armspans and describe its shape.
    2. Would an armspan of 201cm be unusual? Explain.
    3. Find your armspan (the command print(armspans, n = 32) will show all data rows; view(armspans) will open the data table in a viewer window). Which quartile of the class are you in with respect to armspan?
    4. Pretend that our class is a representative sample of some broader population with respect to armspan. Compute and interpret a 95% confidence interval for the mean armspan.
load('data/armspans.RData')

# part a: construct a histogram
arm <- armspans$armspan
hist(arm, breaks = 6)

# part b: would 201cm be unusual? (hint: check deviation relative to sd)
(201-mean(arm))/sd(arm)
[1] 3.121887
# part c: find your armspan and compute percentile
quantile(arm, probs = c(0, .25, .5, .75, 1))
    0%    25%    50%    75%   100% 
141.00 157.75 164.50 171.00 191.00 
# part d: confidence interval for mean armspan
arm.mean <- mean(arm)
arm.se <- sd(arm)/sqrt(32)
cval <- qt(0.975, df = 31)
arm.mean + cval*c(-1, 1)*arm.se
[1] 161.2956 169.5169
  1. The distribution is unimodal and plausibly symmetric (though with too narrow bins there is no evident shape).
  2. Yes: this is approximately 3 standard deviations from the average value.
  3. The quartiles are shown above; locate yours. For example, 156 is in the first quartile since it’s between the 0th and 25th percentiles.
  4. With 95% confidence, the mean armspan is estimated to be between 161.3 and 169.5 cm.