Information Technology Reference
In-Depth Information
> x <- rnorm(50, mean=100, sd=15)
> t.test(x)
One Sample t-test
data: x
t = 59.2578, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
97.16167 103.98297
sample estimates:
mean of x
100.5723
In this example, the confidence interval is approximately 97.16 < μ < 103.98, which is
sometimes written simply as (97.16, 103.98).
We can raise the confidence level to 99% by setting conf.level=0.99 :
> t.test(x, conf.level=0.99)
One Sample t-test
data: x
t = 59.2578, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
99 percent confidence interval:
96.0239 105.1207
sample estimates:
mean of x
100.5723
That change widens the confidence interval to 96.02 < μ < 105.12.
1.13 Forming a Confidence Interval for a Proportion
Problem
You have a sample of values from a population consisting of successes and failures.
Based on the sample data, you want to form a confidence interval for the population's
proportion of successes.
Solution
Use the prop.test function. Suppose the sample size is n and the sample contains x
successes:
> prop.test(n, x)
The function output includes the confidence interval for p .
 
Search WWH ::




Custom Search