Description Usage Arguments Details Value Side Effects Author(s) Examples
Function to determine the minimum sample size for calculating a statistic based on its the confidence interval.
1 2 |
x |
a numeric vector. |
fun |
an objective function at which to evaluate the sample size; see details. |
sizes |
a numeric vector containing sample sizes; if |
lcl |
the lower confidence limit for the statistic defined in |
ucl |
the upper confidence limit for the statistic defined in |
nboot |
the number of bootstrap samples; it is used only if |
conf.level |
the confidence level for calculating the |
nrep |
the resampling (with replacement) number for each sample size in |
graph |
logical; default is |
... |
further graphical arguments. |
If ucl
or lcl
is NULL
, fun
must be defined as in boot
, i.e.,
the first argument passed will always be the original data and the second will be a vector of indices,
frequencies or weights which define the bootstrap sample. By now, samplesize
considers the
second argument only as index.
A list of
CI |
a vector containing the lower and the upper confidence limit for the statistic evaluated. |
pointsOut |
a data frame containing the sample sizes (in |
If graph = TRUE
, a graphic with the dispersion of the estimates for each sample size,
as well as the graphic containing the number of points outside the confidence interval for
the reference sample.
Anderson Rodrigo da Silva <anderson.agro@hotmail.com>
1 2 3 4 5 6 7 8 9 10 | cv <- function(x, i) sd(x[i]) / mean(x[i]) # coefficient of variation
x = rnorm(20, 15, 2)
cv(x)
samplesize(x, cv)
par(mfrow = c(1, 3), cex = 0.7, las = 1)
samplesize(x, cv, lcl = 0.05, ucl = 0.20)
abline(h = 0.05 * 500, col = "blue") # sample sizes with 5% (or less) out CI
# End (not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.