Seminar aus Statistik für das Magisterstudium - Example 5.1/5.2

From StatWiki

Jump to: navigation, search

Contents


Example 5.1

The prevalence rate of a disease among children in a particular area is believed to be about 30%. How many subjects are required if we wish to determine this prevalence to within about 3 percentage points with 95% confidence that this is true?

# calculates n for a given confidence interval width
power.binom.conf.int = function(prob, conf.int.width, alpha=.05) 
	4*qnorm(1-(alpha/2))^2 * prob * (1-prob) / conf.int.width^2

power.binom.conf.int(0.3, 0.03)

#
[1] 3585.362

Example 5.2

Suppose all that is known about the prevalence of the disease is that it might be somewhere between 10% and 40%. How does this effect the sample size calculation described in Example 5.1?

pdf(rpdf)

prob=seq(.1,.4,length.out=100)
plot(prob,ceiling(power.binom.conf.int(prob, 0.03)),type="l", lty=2, ylab="n", xlab="Proportion")

#
Personal tools