Tech Notes

My notes on Statistics, Big Data, Cloud Computing, Cyber Security

Tag Archives: confidence interval

Confidence Interval Examples

Example 1 :  Confidence interval for proportions

Statement : In a poll of 200 people, 152 people had a computer. Estimate the proportion of people who have at least 1 computer at 95% confidence interval


Calculation :

1-sample proportions test with continuity correction
data: 152 out of 200, null probability 0.5
X-squared = 53.045, df = 1, p-value = 3.26e-13
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.6936108 0.8161811
sample estimates:

Alternative 1 :

for 95% conf int,

zstar = 1.96
n = 200
phat = 152/200 # sample proportion
SE = sqrt(phat∗(1−phat)/n); # standard error
MOE = zstar * SE # Margin of error
CI = phat + c(−MOE, MOE)
[1] 0.7008093 0.8191907

So Basically, the point estimate is 0.76 and the margin of error is +/- 0.059

We are 95% confident that at the proportion of people with at least 1 computer is between 70% and 81.9%
Example 2 – Sample size for estimating proportions

In the above example the MOE was 5.9%. What sample size do we need for getting a MOE of 3%

using the formula above,


substitute MOE to be 0.03 and we get n = 778.54

Example 3 – Confidence Intervals about the Mean, Population Standard Deviation Unknown

25 test takers had a mean of 520 marks with a SD of 80. Construct a 95% confidence interval about the mean


s = 80
n = 25
SE = s/sqrt(n)
[1] 16
MOE = qt(.975, df=n−1)∗SE
[1] 33.02238
xbar = 520
xbar + c(−MOE, MOE)
[1] 486.9776 553.0224

Example 4 : Confidence Intervals about the Mean, Population Standard Deviation Known


Calculations, similar to Eg 3. Only difference is that the MOE calculation

MOE = qnorm(.975)∗SE

Disclaimer : These are my study notes – online – instead of on paper so that others can benefit. In the process I’ve have used some pictures / content from other original authors. All sources / original content publishers are listed below and they deserve credit for their work. No copyright violation intended.

Referencesfor these notes :

The study material for the MOOC “Making sense of data” at

Confidence Interval and Level

Confidence Interval

The purpose of taking a random sample from a lot or population and computing a statistic, such as the mean from the data, is to approximate the mean of the population. How well the sample statistic estimates the underlying population value is always an issue. A confidence interval addresses this issue because it provides a range of values which is likely to contain the population parameter of interest. Read more of this post

Multiple Factor Regression

Multiple regression aims is to find a linear relationship between a response variable and several possible predictor variables

Model that describes more than 1 variable (model that explains the ‘Y’ part) . Can be linear or non linear (but usually is linear)

Read more of this post