6. Parameter Estimation and Confidence Intervals: Practical 6
Confidence Intervals for Proportions
Just as for a mean, we can calculate confidence intervals for a proportion. The calculations for this are almost identical. There are however two differences:
- A proportion follows a z-distribution (rather than a t-distribution) - provided that the sample size is at least 30 (but we will make sure that this is the case here),
- The standard error for a proportion is calculated differently from the standard error of the mean: for an estimated proportion (#\hat{p}#) from a sample of size #n#, the standard error is #se_{\hat{p}}=\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}#
To practice with calculating confidence intervals for proportions we turn to data frame D in the same 'groene daken' dataset, which contains information about different types of green roofs per city district (stadsdeel). We will also assume here that this data set contains the information of the entire population.
Let's have a quick look at the data, so that we have an idea of what it contains.
summary(D)
barplot(table(D$soort))
barplot(table(D$stadsdeel))
And now we go straight to the exercises!
Unlock full access