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{σ}_{\hat{π}} after multiplication by a constant. Similarly, the second method(Agresti-Coull-adjusted) adjusts the variance of the estimator \hat{σ}_{\hat{π}_{AC}}, where \hat{π}_{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 y_1, n_1, y_2, and n_2 (see below). These are applied through exception handling here (see Aho and Bowyer 2015).

Let Y_1 and Y_2 be multinomial random variables with parameters n_1, π_{1i}, and n_2, π_{2i}, respectively; where i = \{1, 2, 3, …, r\}. This encompasses the binomial case in which r = 1. We define the true selection ratio for the ith resource of r total resources to be:

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

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

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

and

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

where y_{1i} and y_{2i} are the observed counts for use and availability for the ith resource. If π_{2i}s are known, the estimator for θ_i is:

\hat{θ}_{i}=\frac{\hat{π}_{1i}}{π_{2i}}.

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

 Method Algorithm Agresti Coull-Adjusted {{\hat{θ}}_{ACi}}\pm {{z}_{1-(α /2)}}√{{{{\hat{π }}}_{AC1i}}(1-{{{\hat{π }}}_{AC1i}})/({{n}_{1}}+4){{{\hat{π }}}_{AC1i}}π _{2i}^{2}}, where {{\hat{π}}_{AC1i}}=\frac{{{y}_{1}}+z^2/2}{{{n}_{1}}+z^2}, and {{\hat{θ }}_{ACi}}=\frac{{{\hat{π}}_{AC1i}}}{{{π }_{2i}}}, where z is the standard normal inverse cdf at probability 1 - α/2 (\approx 2 when α= 0.05). Bayes-beta (\frac{X_{α/2}}{π_{2i}} , \frac{X_{1-(α/2)}}{π_{2i}}), where X \sim BETA(y_{1i} + γ_{i}, n_1 + β - y_{1i}). Fixed-log {{\hat{θ }}_{i}}\times \exp ≤ft( \pm {{z}_{1-α /2}}{{{\hat{σ }}}_{F}} \right), where \hat{σ}_{^{F}}^{2}=(1-{{\hat{π}}_{1i}})/{{\hat{π}}_{1i}}{{n}_{1}}. Noether-fixed \frac{{{{\hat{π }}}_{1i}}/{{π }_{2}}}{1+z_{1-(α /2)}^{2}}1+\frac{z_{1-(α /2)}^{2}}{2{{y}_{1i}}}\pm z_{1-(α /2)}^{2}√{\hat{σ}_{NF}^{2}+\frac{z_{1-(α /2)}^{2}}{4y_{1i}^{2}}}, where \hat{σ }_{NF}^{2}=\frac{1-{{{\hat{π }}}_{1i}}}{{{n}_{1}}{{{\hat{π }}}_{1i}}}. Wald-adjusted {{\hat{θ }}_{i}}\pm {{z}_{1-(α /2)}}√{{{{\hat{π }}}_{1i}}(1-{{{\hat{π }}}_{1i}})/{{n}_{1}}{{{\hat{π }}}_{1i}}π _{2i}^{2}}.

### Value

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

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.

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