The provided code splits the body temperature data into two groups by sex. Use this data to do the following.
Compute a 90% confidence interval for the mean female body temperature and interpret the interval in context in the style introduced in class.
Compute a 90% confidence interval for the mean male body temperature and interpret the interval in context in the style introduced in class.
Based on your intervals, is it plausible that there is no difference in mean temperature by sex? Why or why not?
Solution
load('data/temps2.RData')# split observations into two groups by sextemps.split <-split(temps$body.temp, temps$sex)# store male and female temperaturestemps.m <- temps.split$maletemps.f <- temps.split$female# part a: confidence interval for mean body temps for femaletemps.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 maletemps.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
With 90% confidence, the mean female body temperature is estimated to be between 98.24 and 98.55 degrees Farenheit.
With 90% confidence, the mean male body temperature is estimated to be between 97.96 and 98.24 degrees Farenheit.
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.
The armspans dataset contains the 32 armspan measurements from last class.
Construct a histogram of the armspans and describe its shape.
Would an armspan of 201cm be unusual? Explain.
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?
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.
Solution
load('data/armspans.RData')# part a: construct a histogramarm <- armspans$armspanhist(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 percentilequantile(arm, probs =c(0, .25, .5, .75, 1))