> # 1
> qplot(Brainsize, data = ex0333) + facet_wrap(~ Littersize, ncol = 1)
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.

Both groups show moderate right skew in Brainsize. The Large litter size mammals appear to have greater spread in Brainsize than the Small litter size mammals. (1 pt)
> # 2
> qplot(log(Brainsize), data = ex0333) + facet_wrap(~ Littersize, ncol = 1)
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.

After the log transform both groups have more symmetric distributions. The log transform has also reduced the difference in spread between the Large and Small mammals. (1 pt)
> # 3
> small <- subset(ex0333, Littersize == "Small")$Brainsize
> large <- subset(ex0333, Littersize == "Large")$Brainsize
> log_size_sm <- log(small)
> log_size_lg <- log(large)
(0.5 pt)
> # 4
> mean(log_size_lg) - mean(log_size_sm)
[1] 0.3969683
(0.5 pt)
> # 5
> exp(mean(log_size_lg) - mean(log_size_sm))
[1] 1.487309
We estimate that the population median of brainsize for mammals with Large littersize is 1.49 times the population median of brainsize for mammals with Small littersize.
(3 pts, one for number, one for talking about medians, one for “times”)
> # 6
>
> # means
> ybar1 <- mean(log_size_sm)
> ybar2 <- mean(log_size_lg)
> # sds
> sd1 <- sd(log_size_sm)
> sd2 <- sd(log_size_lg)
> # n
> n1 <- length(log_size_sm)
> n2 <- length(log_size_lg)
>
> # pooled standard deviation
> sp <- sqrt( ( (n1 - 1) * sd1^2 + (n2 - 1) * sd2^2 ) / (n1 + n2 - 2) )
>
> se <- sp * sqrt(1/n1 + 1/n2)
> df <- n1 + n2 - 2
>
> (lower <- (ybar2 - ybar1) - se * qt(0.975, df))
[1] -0.002109577
> (upper <- (ybar2 - ybar1) + se * qt(0.975, df))
[1] 0.7960461
A 95% confidence interval on the difference in population means (large litter size - small litter size) for log brain size is -0.002 and 0.80.
(1 pts for calculation, don’t need the interpretation.)
> exp(lower)
[1] 0.9978926
> exp(upper)
[1] 2.216759
(3 pts, one for correct values, one for “median”, one for “times” or “ratio”)
With 95% confidence the population median brain size of mammals with Large littersizes is between 1 and 2.21 times larger than the median brain size of mammals with Small litter sizes for mammals in this study.
If you did things the other way around (small - large):
With 95% confidence the population median brain size of mammals with Small littersizes is between 0.45 and 1 times smaller than the median brain size of mammals with Large litter sizes for mammals in this study.