DASI - COURSERA

A group of researchers want to test the possible effect of an epilepsy medication taken by pregnant mothers
on the cognitive development of their children. 

As evidence, they want to estimate the IQ scores of three-year-old children born to mothers who were on this
particular medication during pregnancy. 

Previous studies suggest that the standard deviation of IQ scores of three-year-old children is 18 points. 

At east how many such children should the researchers sample at a minimum in order to obtain an 80% confidence
interval with a margin of error of at most 4 points?
s <- 18  # Standard deviation

ME <- 4  # Margin of error

conf <- 0.80  # Confidence interval

z.score <- qnorm((1 - conf) / 2)

(z.score * s / ME)^2
## [1] 33.25808
Corerct value is = 33.25808 or 34 (approx)