Learn R Programming

aod (version 1.1-35)

varbin: Mean, Variance and Confidence Interval of a Proportion

Description

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.

Usage

varbin(n, y, data, alpha = 0.05, R = 5000)

Arguments

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.

Value

  • An object of formal class varbin, with 5 slots:
  • CALLThe call of the function.
  • tabA 4-column data frame giving for each estimation method the mean, variance, upper and lower limits of the $(1 - \alpha)$ confidence interval.
  • bootA numeric vector containing the R bootstrap replicates of the proportion. Might be used to compute other kinds of CI's for the proportion.
  • alphaThe significance level used to compute the $(1 - \alpha)$ confidence intervals.
  • featuresA numeric vector with 3 components summarizing the main features of the data: N = number of clusters, n = number of subjects, y = number of cases.
  • The show method displays the slot tab described above, substituting the standard error to the variance.

Details

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.

References

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.

See Also

varbin-class, boot

Examples

Run this code
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))

Run the code above in your browser using DataLab