ci.prat.ak {asbio}R Documentation

Confidence intervals for ratios of proportions when the denominator is known

Description

It is increasingly possible that resource availabilities on a landscape will be known. For instance, in remotely sensed imagery with sub-meter resolution, the areal coverage of resources can be quantified to a high degree of precision, at even large spatial scales. Included in this function are six methods for computation of confidence intervals for a true ratio of proportions when the denominator proportion is known. The first (adjusted-Wald) results from the variance of the estimator σ^π^\hat{\sigma}_{\hat{\pi}} after multiplication by a constant. Similarly, the second method(Agresti-Coull-adjusted) adjusts the variance of the estimator σ^π^AC\hat{\sigma}_{\hat{\pi}_{AC}}, where π^AC=(y+2)/(n+4)\hat{\pi}_{AC}=(y+2)/(n+4). The third method (fixed-log) is based on delta derivations of the logged ratio. The fourth method is Bayesian and based on the beta posterior distribution derived from a binomial likelhood function and a beta prior distribution. The fifth procedure is an older method based on Noether (1959). Sixth, bootstrapping methods can also be implemented.

Usage

ci.prat.ak(y1, n1, pi2 = NULL, method = "ac", conf = 0.95, bonf = FALSE, 
bootCI.method = "perc", R = 1000, sigma.t = NULL, r = length(y1), gamma.hyper = 1, 
beta.hyper = 1)

Arguments

y1

The ratio numerator number of successes. A scalar or vector.

n1

The ratio numerator number of trials. A scalar or vector of length(y1)

pi2

The denominator proportion. A scalar or vector of length(y1)

method

One of "ac", "wald", "noether-fixed", "boot", "fixed-log" or "bayes" for the Agresti-Coull-adjusted, adjusted Wald, noether-fixed, bootstrapping, fixed-log and Bayes-beta, methods, respectively. Partial distinct names can be used.

conf

The level of confidence, i.e. 1 - P(type I error).

bonf

Logical, indicating whether or not Bonferroni corrections should be applied for simultaneous inference if y1, y2, n1 and n2 are vectors.

bootCI.method

If method = "boot" the type of bootstrap confidence interval to calculate. One of "norm", "basic", "perc", "BCa", or "student". See ci.boot for more information.

R

If method = "boot" the number of bootstrap samples to take. See ci.boot for more information.

sigma.t

If method = "boot" and bootCI.methd = "student" a vector of standard errors in association with studentized intervals. See ci.boot for more information.

r

The number of ratios to which family-wise inferences are being made. Assumed to be length(y1).

gamma.hyper

If method = "bayes". A scalar or vector. Value(s) for the first hyperparameter for the beta prior distribution.

beta.hyper

If method = "bayes". A scalar or vector. Value(s) for the second hyperparameter for the beta prior distribution.

Details

Koopman et al. (1984) suggested methods for handling extreme cases of y1y_1, n1n_1, y2y_2, and n2n_2 (see below). These are applied through exception handling here (see Aho and Bowyer 2015).

Let Y1Y_1 and Y2Y_2 be multinomial random variables with parameters n1,π1in_1, \pi_{1i}, and n2,π2in_2, \pi_{2i}, respectively; where i={1,2,3,,r}i = \{1, 2, 3, \dots, r\}. This encompasses the binomial case in which r=1r = 1. We define the true selection ratio for the ith resource of r total resources to be:

θi=π1iπ2i\theta_{i}=\frac{\pi _{1i}}{\pi _{2i}}

where π1i\pi_{1i} and π2i\pi_{2i} represent the proportional use and availability of the ith resource, respectively. If r=1r = 1 the selection ratio becomes relative risk. The maximum likelihood estimators for π1i\pi_{1i} and π2i\pi_{2i} are the sample proportions:

π^1i=y1in1,{{\hat{\pi }}_{1i}}=\frac{{{y}_{1i}}}{{{n}_{1}}},

and

π^2i=y2in2{{\hat{\pi }}_{2i}}=\frac{{{y}_{2i}}}{{{n}_{2}}}

where y1iy_{1i} and y2iy_{2i} are the observed counts for use and availability for the ith resource. If π2i\pi_{2i}s are known, the estimator for θi\theta_i is:

θ^i=π^1iπ2i.\hat{\theta}_{i}=\frac{\hat{\pi}_{1i}}{\pi_{2i}}.

The function ci.prat.ak assumes that selection ratios are being specified (although other applications are certainly possible). Therefore it assume that y1iy_{1i} must be greater than 0 if π2i=1\pi_{2i} = 1, and assumes that y1iy_{1i} must = 0 if π2i=0\pi_{2i} = 0. Violation of these conditions will produce a warning message.

Method Algorithm
Agresti Coull-Adjusted θ^ACi±z1(α/2)π^AC1i(1π^AC1i)/(n1+4)π^AC1iπ2i2{{\hat{\theta}}_{ACi}}\pm {{z}_{1-(\alpha /2)}}\sqrt{{{{\hat{\pi }}}_{AC1i}}(1-{{{\hat{\pi }}}_{AC1i}})/({{n}_{1}}+4){{{\hat{\pi }}}_{AC1i}}\pi _{2i}^{2}},
where π^AC1i=y1+z2/2n1+z2{{\hat{\pi}}_{AC1i}}=\frac{{{y}_{1}}+z^2/2}{{{n}_{1}}+z^2}, and θ^ACi=π^AC1iπ2i{{\hat{\theta }}_{ACi}}=\frac{{{\hat{\pi}}_{AC1i}}}{{{\pi }_{2i}}},
where zz is the standard normal inverse cdf at probability 1α/21 - \alpha/2 (2\approx 2 when α=0.05\alpha= 0.05).
Bayes-beta (Xα/2π2i(\frac{X_{\alpha/2}}{\pi_{2i}} , X1(α/2)π2i)\frac{X_{1-(\alpha/2)}}{\pi_{2i}}),
where XBETA(y1i+γi,n1+βy1i)X \sim BETA(y_{1i} + \gamma_{i}, n_1 + \beta - y_{1i}).
Fixed-log θ^i×exp(±z1α/2σ^F){{\hat{\theta }}_{i}}\times \exp \left( \pm {{z}_{1-\alpha /2}}{{{\hat{\sigma }}}_{F}} \right),
where σ^F2=(1π^1i)/π^1in1.\hat{\sigma}_{^{F}}^{2}=(1-{{\hat{\pi}}_{1i}})/{{\hat{\pi}}_{1i}}{{n}_{1}}.
Noether-fixed π^1i/π21+z1(α/2)21+z1(α/2)22y1i±z1(α/2)2σ^NF2+z1(α/2)24y1i2\frac{{{{\hat{\pi }}}_{1i}}/{{\pi }_{2}}}{1+z_{1-(\alpha /2)}^{2}}1+\frac{z_{1-(\alpha /2)}^{2}}{2{{y}_{1i}}}\pm z_{1-(\alpha /2)}^{2}\sqrt{\hat{\sigma}_{NF}^{2}+\frac{z_{1-(\alpha /2)}^{2}}{4y_{1i}^{2}}},
where σ^NF2=1π^1in1π^1i\hat{\sigma }_{NF}^{2}=\frac{1-{{{\hat{\pi }}}_{1i}}}{{{n}_{1}}{{{\hat{\pi }}}_{1i}}}.
Wald-adjusted θ^i±z1(α/2)π^1i(1π^1i)/n1π^1iπ2i2.{{\hat{\theta }}_{i}}\pm {{z}_{1-(\alpha /2)}}\sqrt{{{{\hat{\pi }}}_{1i}}(1-{{{\hat{\pi }}}_{1i}})/{{n}_{1}}{{{\hat{\pi }}}_{1i}}\pi _{2i}^{2}}.

Value

Returns a list of class = "ci". Default output is a matrix with the point and interval estimate.

Author(s)

Ken Aho

References

Aho, K., and Bowyer, T. 2015. Confidence intervals for ratios of proportions: implications for selection ratios. Methods in Ecology and Evolution 6: 121-132.

See Also

ci.prat, ci.p

Examples

ci.prat.ak(3,4,.5)

[Package asbio version 1.9-7 Index]