\(\huge 1.13\)

Large Hospital Simulation

Large hospital has 45 babies a day. The following sample shows the percentage of boys to girls every day for a year.

x <- c("boy", "girl")
percentage_boys_large <- c()
i <- 1

#Loop that samples 45 births a day for 365 days
#The boys are counted and the percentage against girls is calculated and put in a vector.
while(i <= 365) {
  count <- 0
  boys.large.hosp <- sample(x, 45, replace = T)
  for(j in boys.large.hosp) {
    if(j == "boy") {count <- count + 1}
  }
  perc <- count/45
  percentage_boys_large <- c(percentage_boys_large, perc)
  i <- i + 1
}

#Plot the vector of percentages
plot(percentage_boys_large, xlab = "Day", ylab = "Percentage of Boys", main = "% of Boys in Large Hospital")

Small Hospital Simulation

Small hospital has 15 babies a day. The following sample shows the percentage of boys to girls every day for a year.

x <- c("boy", "girl")
percentage_boys_small <- c()
i <- 1

#Loop that samples 15 births a day for 365 days
#The boys are counted and the percentage against girls is calculated and put in a vector.
while(i <= 365) {
  count <- 0
  boys.small.hosp <- sample(x, 15, replace = T)
  for(j in boys.small.hosp) {
    if(j == "boy") {count <- count + 1}
  }
  perc <- count/15
  percentage_boys_small <- c(percentage_boys_small, perc)
  i <- i + 1
}

#Plot the vector of percentages
plot(percentage_boys_small, xlab = "Day", ylab = "Percentage of Boys", main = "% of Boys in Small Hospital")

Days Over 60 Percent

Number of days where 60 percent of boys were born in the large hospital

#Cycles through the vector and counts the days where the percentage is greater or equal to 60
over_60 <- c()
for(i in percentage_boys_large){
  if (i >= .6) {over_60 <- c(over_60, i)}
}

perc60 <- length(over_60)
perc60
## [1] 36

Number of days where 60 percent of boys were born in the small hospital

#Cycles through the vector and counts the days where the percentage is greater or equal to 60
over_60 <- c()
for(i in percentage_boys_small){
  if (i >= .6) {over_60 <- c(over_60, i)}
}

perc60 <- length(over_60)
perc60
## [1] 116

Answer

The answer is (B) The Small Hospital. The probability for a boy or girl is 50% each time. Which means, it doesn’t matter how many babies are born each day because the probability of having a boy will be 50% for each birth.

But since we’re looking for the days when the percentage of boys to girls is over 60%, the hospital with the lower sample size has the advantage. With a larger sample size, the standard deviation is smaller, so the likelihood of boys being born more than 60% is less.

I believe many people get it wrong because it’s natural instinct to think the more chances you have at something, the likelihood of getting what you want it higher.

Extreme Sample Size

Super-Sized Hospital has 1000 babies a day. The following sample shows the percentage of boys to girls every day for a year.

x <- c("boy", "girl")
percentage_boys_small <- c()
i <- 1

#Loop that samples 1000 births a day for 365 days
#The boys are counted and the percentage against girls is calculated and put in a vector.
while(i <= 365) {
  count <- 0
  boys.small.hosp <- sample(x, 1000, replace = T)
  for(j in boys.small.hosp) {
    if(j == "boy") {count <- count + 1}
  }
  perc <- count/1000
  percentage_boys_small <- c(percentage_boys_small, perc)
  i <- i + 1
}

#Plot the vector of percentages
plot(percentage_boys_small, xlab = "Day", ylab = "Percentage of Boys", main = "% of Boys in Small Hospital")

Number of days where 60 percent of boys were born in the Super-Sized Hospital

#Cycles through the vector and counts the days where the percentage is greater or equal to 60
over_60 <- c()
for(i in percentage_boys_small){
  if (i >= .6) {over_60 <- c(over_60, i)}
}

perc60 <- length(over_60)
perc60
## [1] 0