Sprop.Rd
The function Sprop
estimates the proportion out of samples either with or without
consideration of finite population correction. Different methods for calculating
confidence intervals for example based on binomial distribution (Agresti and
Coull or Clopper-Pearson) or based on hypergeometric distribution are used.
Sprop(y, m, n = length(y), N = Inf, level = 0.95)
y | vector of sample data containing values 0 and 1 |
---|---|
m | an optional non-negative integer for number of positive events |
n | an optional positive integer for sample size. Default is |
N | positive integer for population size. Default is |
level | coverage probability for confidence intervals. Default is |
Sprop
can be called by usage of a data vector y
with the observations 1 for event and 0 for failure. Moreover, it can be called by specifying the number of events m
and trials n
.
The function Sprop
returns a value, which is a list consisting of the components
is a list of call components: y
sample data, m
number of positive events in the sample, n
sample size, N
population size, level
coverage probability for confidence intervals
proportion estimate
standard error of the proportion estimate
is a list of confidence interval boundaries for proportion.
In case of a finite population of size N
, it is given approx
, the hypergeometric confidence interval with normal distribution approximation, and exact
, the exact hypergeometric confidence interval.
If the population is very large N=Inf
, it is calculated bin
, the binomial confidence interval, which is asymptotic, cp
the exact confidence interval based on binomial distribution (Clopper-Pearson), and ac
, the asymptotic confidence interval based on binomial distribution by Wilson (Agresti and Coull (1998)).
In case of finite population of size N
, it is given a list of confidence interval boundaries for number in population with approx
, the hypergeometric confidence interval with normal distribution approximation, and exact
, the exact hypergeometric confidence interval.
Kauermann, Goeran/Kuechenhoff, Helmut (2010): Stichproben. Methoden und praktische Umsetzung mit R. Springer.
Agresti, Alan/Coull, Brent A. (1998): Approximate Is Better than 'Exact' for Interval Estimation of Binomial Proportions. The American Statistician, Vol. 52, No. 2 , pp. 119-126.
Juliane Manitz
# 1) Survey in company to upgrade office climate Sprop(m=45, n=100, N=300)#> #> Sprop object: Sample proportion estimate #> With finite population correction: N = 300 #> #> Proportion estimate: 0.45 #> Standard error: 0.0408 #> #> 95% approximate confidence interval: #> proportion: [0.37,0.53] #> number in population: [111,159] #> 95% exact hypergeometric confidence interval: #> proportion: [0.3667,0.5367] #> number in population: [110,161]Sprop(m=2, n=100, N=300)#> #> Sprop object: Sample proportion estimate #> With finite population correction: N = 300 #> #> Proportion estimate: 0.02 #> Standard error: 0.0115 #> #> 95% approximate confidence interval: #> proportion: [-0.0025,0.0425] #> number in population: [0,12] #> 95% exact hypergeometric confidence interval: #> proportion: [0.0067,0.0633] #> number in population: [2,19]# 2) German opinion poll for 03/07/09 with # (http://www.wahlrecht.de/umfragen/politbarometer.htm) # a) 302 of 1206 respondents who would elect SPD. # b) 133 of 1206 respondents who would elect the Greens. Sprop(m=302, n=1206, N=Inf)#> #> Sprop object: Sample proportion estimate #> Without finite population correction: N = Inf #> #> Proportion estimate: 0.2504 #> Standard error: 0.0125 #> #> 95% asymptotic confidence interval: #> proportion: [0.226,0.2749] #> 95% asymptotic confidence interval with correction by Wilson: #> proportion: [0.2268,0.2756] #> 95% exact confidence interval by Clopper-Pearson: #> proportion: [0.2262,0.2759] #>Sprop(m=133, n=1206, N=Inf)#> #> Sprop object: Sample proportion estimate #> Without finite population correction: N = Inf #> #> Proportion estimate: 0.1103 #> Standard error: 0.009 #> #> 95% asymptotic confidence interval: #> proportion: [0.0926,0.128] #> 95% asymptotic confidence interval with correction by Wilson: #> proportion: [0.0938,0.1292] #> 95% exact confidence interval by Clopper-Pearson: #> proportion: [0.0932,0.1293] #># 3) Rare disease of animals (sample size n=500 of N=10.000 animals, one infection) # for 95% one sided confidence level use level=0.9 Sprop(m=1, n=500, N=10000, level=0.9)#> #> Sprop object: Sample proportion estimate #> With finite population correction: N = 10000 #> #> Proportion estimate: 0.002 #> Standard error: 0.0019 #> #> 90% approximate confidence interval: #> proportion: [-0.0012,0.0052] #> number in population: [-12,52] #> 90% exact hypergeometric confidence interval: #> proportion: [1e-04,0.0093] #> number in population: [1,93]#> #> Sprop object: Sample proportion estimate #> With finite population correction: N = 200 #> #> Proportion estimate: 0.3846 #> Standard error: 0.1358 #> #> 95% approximate confidence interval: #> proportion: [0.1185,0.6508] #> number in population: [24,130] #> 95% exact hypergeometric confidence interval: #> proportion: [0.14,0.68] #> number in population: [28,136]# is the same as Sprop(m=5, n=13, N=200)#> #> Sprop object: Sample proportion estimate #> With finite population correction: N = 200 #> #> Proportion estimate: 0.3846 #> Standard error: 0.1358 #> #> 95% approximate confidence interval: #> proportion: [0.1185,0.6508] #> number in population: [24,130] #> 95% exact hypergeometric confidence interval: #> proportion: [0.14,0.68] #> number in population: [28,136]