R/finite_pop_sampling.R
prop.ci.Rd
Approximate (1-alpha)100% confidence interval for proportion of a population
prop.ci(n, pest = 0.5, N = Inf, alpha = 0.05)
n | Sample size |
---|---|
pest | Estimated positive proportion |
N | Population size (default implies infinite population) |
alpha | The confidence interval is (1-alpha)*100% |
Note that this value is generally similar to that obtained with the
sampling based approach in truepos_given_sample
when
pest=0.5
but becomes an increasingly bad approximation as the
proportion tends to 0 or 1.
See https://onlinecourses.science.psu.edu/stat414/node/264
Other population-sampling: required.sample.size
,
sample_finite_population
,
truepos_given_sample
# 95% confidence interval for population size 43, sample size 10 and estimated # proportion of 0.1 ... # expressed as a proportion prop.ci(10, pest=0.1, N=43)#> [1] -0.06481687 0.26481687# as a number of positives prop.ci(10, pest=0.1, N=43)*43#> [1] -2.787126 11.387126## Compare with sampling based calculation prop.ci(10, pest=0.5, N=48, alpha=.1)*48#> [1] 12.77513 35.22487#> 5% Median Mode 95% #> 15 25 26 35# more different prop.ci(10, pest=0.2, N=48, alpha=.1)*48#> [1] 0.620103 18.579897#> 5% Median Mode 95% #> 5 12 10 22