| CIpilen_data {exams.forge} | R Documentation |
Confidence Interval and Sample Size for the Population Proportion
Description
Data generation for the necessary sample size of a confidence interval, for the population proportion, using z^2/l^2).
Either the estimation error e or the length of the interval l must be given (l=2*e).
It is ensured that the computed p deviates from pi.
Usage
CIpilen_data(
pi,
e = NULL,
l = NULL,
conf.level = c(0.9, 0.95, 0.99),
nmin = 30,
size = NA,
u = c(seq(0.1, 0.4, 0.001), seq(0.6, 0.9, 0.001)),
full = FALSE
)
dcipilen(
pi,
e = NULL,
l = NULL,
conf.level = c(0.9, 0.95, 0.99),
nmin = 30,
size = NA,
u = c(seq(0.1, 0.4, 0.001), seq(0.6, 0.9, 0.001)),
full = FALSE
)
Arguments
pi |
numeric: vector of possible population proportions |
e |
numeric: vector of estimation errors |
l |
numeric: vector of lengths of the interval |
conf.level |
numeric: vector of confidence levels of the interval (default: |
nmin |
numeric: minimal value of necessary observation (default: |
size |
numeric: sample size for computing a sample standard deviation. Default |
u |
numeric: vector of quantiles used to sample the sample standard deviation (default: |
full |
logical: if |
Value
A data frame or a list with:
-
eestimation error -
pipopulation proportion -
conf.levelconfidence level -
linterval length -
x1-alpha/2 -
qz_{1-alpha/2} -
q2z^2_{1-alpha/2} -
ncomputed minimal sample size -
Nthe smallest integer, no less thann -
psample proportion
Examples
# one solution
CIpilen_data((1:9/10), (1:9)/10)
# all solutions
pil <- CIpilen_data((1:9/10), (1:9)/10, full=TRUE)
str(pil)