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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.