-
-
Save gabrielzanlorenssi/6147de7e1d750a9b1fc88280ef3ac96b to your computer and use it in GitHub Desktop.
Calculando margem de erro
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
### calculando margem de erro | |
# p = probabilidade | |
# n = tamanho da amostra | |
# z = 1.96 para 95% de confiança em um teste bicaudal | |
# base = 1 para probabilidades de 0 a 1, ou 100 para probabilidades de 0 a 100 | |
margem <- function(p, n, z=1.96, base=1) { | |
Margem = z * base * sqrt((p/base * (1-(p/base)))/n) | |
return(Margem) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment