Description Usage Format Source References See Also Examples
In the 1980s, biologists Peter and Rosemary Grant caught and measured all the birds from more than 20 generations of finches on the Galapagos island of Daphne Major. In one of those years, 1977, a severe drought caused vegetation to wither, and the only remaining food source was a large, tough seed, which the finches ordinarily ignored. Were the birds with larger and stronger beaks for opening these tough seeds more likely to survive that year, and did they tend to pass this characteristic to their offspring? The data are beak depths (height of the beak at its base) of 89 finches caught the year before the drought (1976) and 89 finches captured the year after the drought (1978).
1 |
A data frame with 178 observations on the following 2 variables.
Year the finch was caught, 1976 or 1978
Beak depth of the finch (mm)
Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cengage Learning.
Grant, P. (1986). Ecology and Evolution of Darwin's Finches, Princeton University Press, Princeton, N.J.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | attach(case0201)
str(case0201)
mean(Depth[Year==1978]) - mean(Depth[Year==1976])
yearFactor <- factor(Year) # Convert the numerical variable Year into a factor
# with 2 levels. 1976 is "group 1" (it comes first alphanumerically)
t.test(Depth ~ yearFactor, var.equal=TRUE) # 2-sample t-test; 2-sided by default
t.test(Depth ~ yearFactor, var.equal=TRUE,
alternative = "less") # 1-sided; alternative: group 1 mean is less
boxplot(Depth ~ Year,
ylab= "Beak Depth (mm)",
names=c("89 Finches in 1976","89 Finches in 1978"),
main= "Beak Depths of Darwin Finches in 1976 and 1978")
## BOXPLOTS FOR PRESENTATION
boxplot(Depth ~ Year,
ylab="Beak Depth (mm)", names=c("89 Finches in 1976","89 Finches in 1978"),
main="Beak Depths of Darwin Finches in 1976 and 1978", col="green",
boxlwd=2, medlwd=2, whisklty=1, whisklwd=2, staplewex=.2, staplelwd=2,
outlwd=2, outpch=21, outbg="green", outcex=1.5)
detach(case0201)
|
'data.frame': 178 obs. of 2 variables:
$ Year : int 1976 1976 1976 1976 1976 1976 1976 1976 1976 1976 ...
$ Depth: num 6.2 6.8 7.1 7.1 7.4 7.8 7.9 8 8.2 8.4 ...
[1] 0.6685393
Two Sample t-test
data: Depth by yearFactor
t = -4.5833, df = 176, p-value = 8.65e-06
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.9564088 -0.3806698
sample estimates:
mean in group 1976 mean in group 1978
9.469663 10.138202
Two Sample t-test
data: Depth by yearFactor
t = -4.5833, df = 176, p-value = 4.325e-06
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
-Inf -0.4273433
sample estimates:
mean in group 1976 mean in group 1978
9.469663 10.138202
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.