Learn Data & AI Skills | 50% off
Get 50% off unlimited learning

asbio (version 1.5-5)

ci.prat.ak: 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 σ^π^ after multiplication by a constant. Similarly, the second method(Agresti-Coull-adjusted) adjusts the variance of the estimator σ^π^AC, where π^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.

Value

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

Details

Koopman et al. (1984) suggested methods for handling extreme cases of y1, n1, y2, and n2 (see below). These are applied through exception handling here (see Aho and Bowyer 2015).

Let Y1 and Y2 be multinomial random variables with parameters n1,π1i, and n2,π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=π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:

π^1i=y1in1, and π^2i=y2in2

where y1i and y2i are the observed counts for use and availability for the ith resource. If π2is are known, the estimator for θi is:

θ^i=π^1iπ2i.

The function ci.prat.ak assumes that selection ratios are being specified (although other applications are certainly possible). Therefore it assume that y1i must be greater than 0 if π2i=1, and assumes that y1i must = 0 if π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, where π^AC1i=y1+z2/2n1+z2, and θ^ACi=π^AC1iπ2i, where z is the standard normal inverse cdf at probability 1α/2 (2 when α=0.05). Bayes-beta (Xα/2π2i , X1(α/2)π2i), where XBETA(y1i+γi,n1+βy1i). Fixed-log θ^i×exp(±z1α/2σ^F), where σ^F2=(1π^1i)/π^1in1. Noether-fixed π^1i/π21+z1(α/2)21+z1(α/2)22y1i±z1(α/2)2σ^NF2+z1(α/2)24y1i2, where σ^NF2=1π^1in1π^1i. Wald-adjusted θ^i±z1(α/2)π^1i(1π^1i)/n1π^1iπ2i2.

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

Run this code
# NOT RUN {
ci.prat.ak(3,4,.5)
# }

Run the code above in your browser using DataLab