Created
January 9, 2014 12:45
-
-
Save felixlindemann/8333576 to your computer and use it in GitHub Desktop.
Ermittlung von Stichprobengrößen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on formula by | |
# Cochran, W. G. 1963. Sampling Techniques, 2nd Ed., New York: John Wiley and Sons, Inc. | |
# see also http://statistikberatung.blogspot.de/2008/03/samplesizer-kostenloses-tool-zur.html | |
get.SampleSize <- function(N, Z, p, e){ | |
n <- ( | |
Z^2 * p * (1-p) / e^2 | |
) / | |
( | |
1 + ( | |
Z^2 * p * (1-p) / e^2 -1 | |
) / N | |
) | |
return(n) | |
} | |
N<- 14500 # Elemente in Grundgesamtheit | |
e<- 0.04 # Konfidenzniveau | |
p<- 0.5 # Fehlerwahrscheinlichkeit | |
Z <- 1.96 # Z-Wert d. Normalverteilung | |
get.SampleSize(N,Z,p,e) | |
# 576 | |
e<- 0.05 # Konfidenzniveau | |
get.SampleSize(N,Z,p,e) | |
e<- 0.01 # Konfidenzniveau | |
get.SampleSize(N,Z,p,e) | |
N<- 15024 | |
e<- 0.0378 # Konfidenzniveau | |
get.SampleSize(N,Z,p,e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment