CI.t.test: Student's t-Confidence Interval with Finite Population...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/CI.t.test.R

Description

Performs two-sided confidence interval on population mean, allowing for a finite population correction.

Usage

1
CI.t.test(x, conf.level = 0.95, fpc = 1)

Arguments

x

A nonempty numeric vector of data values.

conf.level

Confidence level of the interval, and should be between 0 and 1.

fpc

The finite population correction, and should be between 0 and 1.

Details

The fpc is typically defined as 1-n/N, where n is the sample size, and N is the population size, for simple random sampling without replacement. When sampling with replacement, set fpc=1 (default).

Value

A confidence interval for the population mean.

Note

The definition of fpc is based on the textbook by Scheaffer, Mendenhall, Ott, Gerow (2012), chapter 4.

Author(s)

Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA

References

Scheaffer, R. L., Mendenhall, W., Ott, R. L., Gerow, K. G. (2012) Elementary Survey Sampling, 7th edition.

See Also

t.test and plotCI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Sample 43 observations from a population of 200 numbers, and compute the 95% confidence interval.
pop = sqrt(1:200) ; x1 = sample( pop, 43 ) ; print(sort(x1))

CI.t.test( x1, fpc = 1-length(x1)/length(pop) )

# Sample 14 observations from a Normal(mean=50, sd=5) distribution,
#    and compute the 90% confidence interval.
x2 = rnorm( 14, 50, 5 ) ; print(sort(x2)) 

CI.t.test( x2, 0.9 )

Example output

 [1]  1.414214  2.645751  4.690416  4.795832  5.567764  5.916080  6.164414
 [8]  6.324555  6.480741  6.633250  7.348469  7.549834  7.681146  8.185353
[15]  8.246211  8.544004  9.055385  9.273618  9.486833  9.591663  9.797959
[22] 10.440307 10.630146 11.045361 11.180340 11.575837 11.789826 11.832160
[29] 12.206556 12.449900 12.529964 12.688578 12.727922 12.806248 13.076697
[36] 13.152946 13.228757 13.341664 13.379088 13.527749 13.820275 13.856406
[43] 14.000000
[1]  8.880504 10.686018
 [1] 47.39202 48.18987 48.20609 48.20951 49.77378 50.84966 51.30538 53.99598
 [9] 54.57457 56.14915 56.30249 58.80775 59.33009 60.61250
[1] 50.94740 55.29529

jmuOutlier documentation built on Aug. 6, 2019, 1:03 a.m.