If you roll a pair of fair dice, what is the probability of
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
install.packages('VennDiagram')
## Installing package into 'C:/Users/humberh/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5:
## cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5/PACKAGES'
## package 'VennDiagram' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\humberh\AppData\Local\Temp\RtmpsvpQoX\downloaded_packages
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(14.6, 20.7, 4.2, category = c("Below Poverty Line", "Speak Foreign Language"), fill = c("blue", "green"), alpha = rep(0.5, 2), cat.pos = c(0, 0), cat.dist = rep(0.025, 2))
## (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3], polygon[GRID.polygon.4], text[GRID.text.5], text[GRID.text.6], text[GRID.text.7], text[GRID.text.8], text[GRID.text.9])
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
library("png")
pp <- readPNG("AssortMating.png")
plot.new()
rasterImage(pp,0,0,1,1)
The table below shows the distribution of books on a bookcase based on whether they are non???ction or ???ction and hardcover or paperback
library("png")
pp <- readPNG("Books.png")
plot.new()
rasterImage(pp,0,0,1,1)
An airline charges the following baggage fees: $25 for the ???rst bag and $35 for the second. Suppose 54% of passengers have no checked luggage, 34% have one piece of checked luggage and 12% have two pieces. We suppose a negligible portion of people check more than two bags.
passgrbags <- c(0,1,2)
fees <- c(0, 25, 35)
passprop <- c(0.54, 0.34, 0.12)
passrev <- passprop*fees
## Example with 10 passengers sample
passrev10 <- passrev*10
avgrev10 <- mean(passrev10)
sdrev10 <- sd(passrev10)
avgrev10
## [1] 42.33333
sdrev10
## [1] 42.50098
## Example with 120 passengers sample
passrev120 <- passrev*120
avgrev120 <- mean(passrev120)
sdrev120 <- sd(passrev120)
avgrev120
## [1] 508
sdrev120
## [1] 510.0118
The relative frequency table below displays the distribution of annual total personal income (in 2009 in???ation-adjusted dollars) for a representative sample of 96,420,486 Americans. These data come from the American Community Survey for 2005-2009. This sample is comprised of 59% males and 41% females
library("png")
pp <- readPNG("IncomeGender.png")
plot.new()
rasterImage(pp,0,0,1,1)
incomelabels <- c("$1 to $9,999 or less",
"$10,000 to $14,999",
"$15,000 to $24,999",
"$25,000 to $34,999",
"$35,000 to $49,999",
"$50,000 to $64,999",
"$65,000 to $74,999",
"$75,000 to $99,999",
"$100,000 or more")
incomebuckets <- c(1,10,15,25,35,50,65,75,100)
incomepcts <- c(2.2,4.7,15.8,18.3,21.2,13.9,5.8,8.4,9.7)
barplot(incomepcts, main = "Income Distribution", names.arg=incomelabels, las=2)
sum(incomepcts[1:5])
## [1] 62.2