powconsistencytest: Power of Consistency Tests, Partial Stratification

View source: R/consistency.R

powconsistencytestR Documentation

Power of Consistency Tests, Partial Stratification

Description

Conducts power calculations of the chi-squared tests for the consistency of the Petersen-type abundance estimator, in a partial stratification setting, such as by time or geographic area. In the case of partial stratification, individuals may move from one stratum to another between the first and second sampling events, and strata do not need to be the same between events.

Usage

powconsistencytest(n1, n2, pmat, alpha = 0.05, sim = TRUE, nsim = 10000)

Arguments

n1

Vector of anticipated n1 counts (sample size in the first event), each element corresponding to one stratum.

n2

Vector of anticipated n2 counts (sample size in the second event), each element corresponding to one stratum.

pmat

Matrix of assumed movement probabilities between strata, with rows corresponding to first-event strata and columns corresponding to second-event strata, and an additional column corresponding to the probability of NOT being recaptured in the second event. Values will be standardized by row, that is, by first-event strata. See note on usage below.

alpha

Significance level for testing. Defaults to 0.05

sim

Whether to conduct power calculation by simulation as well as Cohen's method. Defaults to TRUE.

nsim

Number of simulations if sim is TRUE. Defaults to 10000.

Value

An object of class "recapr_consistencypow" with the following components:

  • pwr1_c Power of the first test, according to Cohen's method

  • pwr1_sim Power of the first test, from simulation

  • ntest1 The sample size used for the first test

  • p0test1 The null-hypothesis probabilities for the first test

  • p1test1 The alt-hypothesis probabilities for the first test

  • pwr2_c Power of the second test, according to Cohen's method

  • pwr2_sim Power of the second test, from simulation

  • ntest2 The sample size used for the second test

  • p0test2 The null-hypothesis probabilities for the second test

  • p1test2 The alt-hypothesis probabilities for the second test

  • pwr3_c Power of the third test, according to Cohen's method

  • pwr3_sim Power of the third test, from simulation

  • ntest3 The sample size used for the third test

  • p0test3 The null-hypothesis probabilities for the third test

  • p1test3 The alt-hypothesis probabilities for the third test

  • alpha The significance level used

Note

The movement probability matrix specified in pmat is considered conditional on each row, that is, first-event strata, with columns corresponding to second-event strata and the final column specifying the probability of not being recaptured in the second event. Values do not need to sum to one for each row, but will be standardized by the function to sum to one.

A pmat with a first row equal to (0.05, 0.1, 0.15, 0.7) would imply a 5 percent chance that individuals captured in the first-event strata 1 will be recaptured in second-event strata 1, and a 70 percent chance that individuals captured in the first-event strata 1 will not be recaptured in event 2.

Because of the row-wise scaling, specifying a row equal to (0.05, 0.1, 0.15, 0.7) would be equivalent to that row having values (1, 2, 3, 14).

Author(s)

Matt Tyers

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.

Code adapted from the 'pwr' package: Stephane Champely (2015). pwr: Basic Functions for Power Analysis. R package version 1.1-3. https://CRAN.R-project.org/package=pwr

See Also

consistencytest, NDarroch

Examples

mat <- matrix(c(4,3,2,1,10,3,4,3,2,10,2,3,4,3,10,1,2,3,4,10),
    nrow=4, ncol=5, byrow=TRUE)
powconsistencytest(n1=c(50,50,50,50), n2=c(50,50,50,50), pmat=mat)

mat <- matrix(c(4,3,2,1,10,4,3,2,1,10,4,3,2,1,10,4,3,2,1,10),
    nrow=4, ncol=5, byrow=TRUE)
powconsistencytest(n1=c(50,50,50,50), n2=c(50,50,50,50), pmat=mat)

mat <- matrix(c(1,1,1,1,10,2,2,2,2,10,3,3,3,3,10,4,4,4,4,10),
    nrow=4, ncol=5, byrow=TRUE)
powconsistencytest(n1=c(50,50,50,50), n2=c(50,50,50,50), pmat=mat)

mat <- matrix(c(1,1,1,1,10,1,1,1,1,10,1,1,1,1,10,1,1,1,1,10),
    nrow=4, ncol=5, byrow=TRUE)
powconsistencytest(n1=c(50,50,50,50), n2=c(20,30,40,50), pmat=mat)

mat <- matrix(c(1,1,1,1,5,1,1,1,1,8,1,1,1,1,10,1,1,1,1,15),
    nrow=4, ncol=5, byrow=TRUE)
powconsistencytest(n1=c(50,50,50,50), n2=c(50,50,50,50), pmat=mat)

mbtyers/recapr documentation built on Dec. 17, 2024, 7:24 p.m.