varbin | R Documentation |
This function computes the mean and variance of a proportion from clustered binomial data (n, y)
, using various
methods. Confidence intervals are computed using a normal approximation, which might be inappropriate when the
proportion is close to 0 or 1.
varbin(n, y, data, alpha = 0.05, R = 5000)
n |
The denominator of the proportion. |
y |
The numerator of the proportion. |
data |
A data frame containing the data. |
alpha |
The significance level for the confidence intervals. Default to 0.05, providing 95% CI's. |
R |
The number of bootstrap replicates to compute the bootstrap mean and variance. |
Five methods are used for the estimations. Let us
consider N
clusters of sizes n_1, \ldots, n_N
with observed responses (counts) y_1, \ldots, y_N
.
We note p_i = y_i / n_i
the observed proportions (i = 1, \ldots, N)
. An underlying assumption is that the
theoretical proportion is homogeneous across the clusters.
Binomial method: the proportion and its variance are estimated as p = \frac{\sum_{i} y_i}{\sum_{i} n_i}
and \frac{p * (1 - p)}{\sum_{i} n_i - 1}
, respectively.
Ratio method: the one-stage cluster sampling formula is used to estimate the variance of the ratio estimate
(see Cochran, 1999, p. 32 and p. 66). The proportion is estimated as above (p
).
Arithmetic method: the proportion is estimated as p_A = \frac{1}{N}\sum_{i}\frac{y_i}{n_i}
, with estimated variance \frac{\sum_{i}(p_i - p_A)^2}{N * (N - 1)}
.
Jackknife method: the proportion p_J
is the arithmetic mean of the pseudovalues pv_i
, with estimated
variance \frac{\sum_{i}(pv_i - p_J)^2}{N * (N - 1)}
(Gladen, 1977, Paul, 1982).
Bootstrap method: R
samples of size N
are drawn with equal probability from the initial sample
(p_1, \ldots , p_N)
(Efron and Tibshirani, 1993). The bootstrap estimate p_B
and its estimated variance
are the arithmetic mean and the empirical variance (computed with denominator R - 1
) of the R
binomial
estimates, respectively.
An object of formal class “varbin”, with 5 slots:
CALL |
The call of the function. |
tab |
A 4-column data frame giving for each estimation method the mean, variance, upper and lower limits
of the |
boot |
A numeric vector containing the R bootstrap replicates of the proportion. Might be used to compute other kinds of CI's for the proportion. |
alpha |
The significance level used to compute the |
features |
A numeric vector with 3 components summarizing the main features of the data: |
The “show” method displays the slot tab
described above, substituting the standard error to the variance.
Matthieu Lesnoff matthieu.lesnoff@cirad.fr, Renaud Lancelot renaud.lancelot@cirad.fr
Cochran, W.G., 1999, 3th ed. Sampling techniques. Wiley, New York.
Efron, B., Tibshirani, R., 1993. An introduction to the bootstrap. Chapman and Hall, London.
Gladen, B., 1977. The use of the jackknife to estimate proportions from toxicological data in the presence
of litter effects. JASA 74(366), 278-283.
Paul, S.R., 1982. Analysis of proportions of affected foetuses in teratological experiments.
Biometrics 38, 361-370.
varbin-class
, boot
data(rabbits)
varbin(n, y, rabbits[rabbits$group == "M", ])
by(rabbits,
list(group = rabbits$group),
function(x) varbin(n = n, y = y, data = x, R = 1000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.