Description Usage Arguments Details Value Author(s) References See Also Examples
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.
| 1 | 
| 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
| call | is a list of call components:  | 
| p | proportion estimate | 
| se | standard error of the proportion estimate | 
| ci | is a list of confidence interval boundaries for proportion.  | 
| nr | In case of finite population of size  | 
Juliane Manitz
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.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 1) Survey in company to upgrade office climate
Sprop(m=45, n=100, N=300)
Sprop(m=2, n=100, N=300)
# 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(m=133, n=1206, N=Inf)
# 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)
# 4) call with data vector y
y <- c(0,0,1,0,1,0,0,0,1,1,0,0,1)
Sprop(y=y, N=200)
# is the same as
Sprop(m=5, n=13, N=200)
 | 
Loading required package: pps
Loading required package: sampling
Loading required package: survey
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survival’
The following objects are masked from ‘package:sampling’:
    cluster, strata
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
    dotchart
Sprop object: Sample proportion estimate
With finite population correction: N= 300 
Proportion estimate:  0.45 
Standard error:  0.0408 
95% approximate hypergeometric 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 object: Sample proportion estimate
With finite population correction: N= 300 
Proportion estimate:  0.02 
Standard error:  0.0115 
95% approximate hypergeometric confidence interval: 
 proportion: [-0.0025,0.0425]
 number in population: [0,12]
95% exact hypergeometric confidence interval: 
 proportion: [0.0033,0.0633]
 number in population: [1,19]
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 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]
Sprop object: Sample proportion estimate
With finite population correction: N= 10000 
Proportion estimate:  0.002 
Standard error:  0.0019 
90% approximate hypergeometric 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 hypergeometric 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]
Sprop object: Sample proportion estimate
With finite population correction: N= 200 
Proportion estimate:  0.3846 
Standard error:  0.1358 
95% approximate hypergeometric 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]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.