You are interested in heat tolerance in Drosophila. You collect 200 flies from Florida and 200 flies from New York and raise 100 each at 29C and 22C. You then measure the proportion of flies alive after 16 days. Do flies from different populations have significantly different probabilities of survival?
flies <- matrix(c(66, 87, 91, 80), 2, 2)
row.names(flies) <- c("New York", "Florida")
colnames(flies) <- c("Hot", "Cold")
addmargins(flies)
## Hot Cold Sum
## New York 66 91 157
## Florida 87 80 167
## Sum 153 171 324
chisq.test(flies)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: flies
## X-squared = 2.8933, df = 1, p-value = 0.08895
# Observed Proportions
# round(addmargins(proportions(flies, margin = 1)), 2)
# round(addmargins(proportions(flies, margin = 2)), 2)
round(addmargins(proportions(flies)), 2)
## Hot Cold Sum
## New York 0.20 0.28 0.48
## Florida 0.27 0.25 0.52
## Sum 0.47 0.53 1.00
# Expected
expected <- matrix(nrow = 2, ncol = 2)
row.names(expected) <- c("New York", "Florida")
colnames(expected) <- c("Hot", "Cold")
for (i in 1:2){
for (j in 1:2){
expected[i, j] <- sum(flies[i, ]) * sum(flies[, j]) / sum(flies)
}
}
round(addmargins(expected), 2)
## Hot Cold Sum
## New York 74.14 82.86 157
## Florida 78.86 88.14 167
## Sum 153.00 171.00 324
round(addmargins(proportions(expected)), 2)
## Hot Cold Sum
## New York 0.23 0.26 0.48
## Florida 0.24 0.27 0.52
## Sum 0.47 0.53 1.00
You study Lake Tangyanikan cichlids, specifically the scale feeding specialist Perissodus microlepis. These fish exhibit handedness in that their mouths are curved either to the left or to the right. Previous research has shown that negative frequency-dependent selection likely maintains genetic variation that leads to approximately a 50/50 ratio. Of left and right sided fish. You are studying a new isolated population in the lake and find a preponderance of left-sided fish. In your population you find 23 left-sided fish and 9 right-sided fish. Does this population exhibit a significant deviation from a 50/50 ratio of left and right-sided fish?
fishhand <- c(23, 9)
names(fishhand) <- c("left", "right")
fishhand
## left right
## 23 9
binom.test(x = fishhand[1], n = sum(fishhand)) # $p.value
##
## Exact binomial test
##
## data: fishhand[1] and sum(fishhand)
## number of successes = 23, number of trials = 32, p-value = 0.02006
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
## 0.5325289 0.8625431
## sample estimates:
## probability of success
## 0.71875
You study a species of territorial songbirds. Because of the energy investment and exposure to predators that defending a territory entails most populations show a sex ratio skew 68% females 32% males (this is supported by many empirical studies). The population that you are studying doesnโt seem to be so skewed. In your mist-netting of birds, you capture 47 females and 40 males. Is this significantly different from what has been reported in the literature?
birds <- c(40, 47)
names(birds) <- c("male", "female")
birds
## male female
## 40 47
binom.test(x = birds[1], n = sum(birds), p = 0.32)
##
## Exact binomial test
##
## data: birds[1] and sum(birds)
## number of successes = 40, number of trials = 87, p-value = 0.007775
## alternative hypothesis: true probability of success is not equal to 0.32
## 95 percent confidence interval:
## 0.3523337 0.5700235
## sample estimates:
## probability of success
## 0.4597701