Practice: 2.5, 2.7, 2.19, 2.29, 2.43 Graded: 2.6, 2.8, 2.20, 2.30, 2.38, 2.44
If you flip a fair coin 10 times, what is the probability of
dbinom(0, 10, .5)
## [1] 0.0009765625
dbinom(10, 10, .5)
## [1] 0.0009765625
pbinom(1, 10, .5, lower.tail = F)
## [1] 0.9892578
If you roll a pair of fair dice, what is the probability of
sample.space <- rolldie(2)
sample.space$sum <- sample.space$X1 + sample.space$X2
possibilities <- nrow(sample.space)
sum(sample.space$sum==1)/possibilities
## [1] 0
sum(sample.space$sum==5)/possibilities
## [1] 0.1111111
sum(sample.space$sum==12)/possibilities
## [1] 0.02777778
The American Community Survey is an ongoing survey that provides data every year to give communities the current information they need to plan investments and services.
The 2010 American Community Survey estimates that + 14.6% of Americans live below the poverty line, + 20.7% speak a language other than English (foreign language) at home, + and 4.2% fall into both categories.
poverty <- .146
other.language <- .207
both <-.042
a <- "No"
#my.url <- getURLContent("https://raw.githubusercontent.com/kylegilde/D606-Stats/master/venn1.PNG")
b <- "I couldn't figure out how to print an image inside the R code. See below"
c <- poverty - both
d <- poverty + other.language - both
e <- 1 - d
f <- "No"
a;b;c;d;e;f
## [1] "No"
## [1] "I couldn't figure out how to print an image inside the R code. See below"
## [1] 0.104
## [1] 0.311
## [1] 0.689
## [1] "No"
b.
Assortative mating is a nonrandom mating pattern where individuals with similar genotypes and/or phenotypes mate with one another more frequently than what would be expected under a random mating pattern. Researchers studying this topic collected data on eye colors of 204 Scandinavian men and their female partners. The table below summarizes the results. For simplicity, we only include heterosexual relationships in this exercise.
Explain your reasoning.
a <- (114 + 108 - 78)/204
b <- 78/114
c <- 19/54
d <- "No, it appears that the eye colors of the male respondents and their partners are NOT independent. For each eye-color subset of males, it is more likely that the partners share that eye color than any of the other colors."
a;b;c;d
## [1] 0.7058824
## [1] 0.6842105
## [1] 0.3518519
## [1] "No, it appears that the eye colors of the male respondents and their partners are NOT independent. For each eye-color subset of males, it is more likely that the partners share that eye color than any of the other colors."
red <- 5
blue <- 3
orange <- 2
total <- red+blue+orange
(blue -1)/(total -1)
## [1] 0.2222222
blue/(total - 1)
## [1] 0.3333333
blue/total * (blue - 1)/(total - 1)
## [1] 0.06666667
The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback.
Type Hardcover Paperback Total
Fiction 13 59 72
Nonfiction 15 8 23
Total 28 67 95
books <- matrix( c(13,59,15,8), 2,2, byrow = T)
a <- sum(books[,1])/sum(books) * books[1,2]/(sum(books)-1)
b <- books[1,1]/sum(books) * sum(books[,1] - 1)/(sum(books)-1) + books[1,2]/sum(books) * sum(books[,1])/(sum(books)-1)
c <- sum(books[1,])/sum(books) * sum(books[,1])/sum(books)
d <- "In this scenario, drawing books w/ and w/o replacement has only the tiniest effect on the overall probability"
a;b;c;d
## [1] 0.1849944
## [1] 0.2228443
## [1] 0.2233795
## [1] "In this scenario, drawing books w/ and w/o replacement has only the tiniest effect on the overall probability"
The relative frequency table below displays the distribution of annual total personal income (in 2009 inflation-adjusted dollars) for a representative sample of 96,420,486 Americans. These data come from the American Community Survey for 2005-2009.
Income Total
$1 to $9,999 or loss 2.2%
$10,000 to $14,999 4.7%
$15,000 to $24,999 15.8%
$25,000 to $34,999 18.3%
$35,000 to $49,999 21.2%
$50,000 to $64,999 13.9%
$65,000 to $74,999 5.8%
$75,000 to $99,999 8.4%
$100,000 or more 9.7%
This sample is comprised of 59% males and 41% females.
perc <- c(0.022, 0.047, 0.158, 0.183, 0.212, 0.139, 0.058, 0.084, 0.097)
m <- .59
f <- .41
a <- "It's distributed vaguely normally, except that there is a lot more kurtosis in the right tail than the left tail."
b <- sum(perc[1:5])
c <- b * f
print("You have to assume that the the proportion of females is evenly distributed accoss all income brackets")
## [1] "You have to assume that the the proportion of females is evenly distributed accoss all income brackets"
d <- "That the female population is disproportionately distributed in the less than $50K brackets makes my previous assumption and calcalution incorrect."
a;b;c;d
## [1] "It's distributed vaguely normally, except that there is a lot more kurtosis in the right tail than the left tail."
## [1] 0.622
## [1] 0.25502
## [1] "That the female population is disproportionately distributed in the less than $50K brackets makes my previous assumption and calcalution incorrect."