Movatterモバイル変換


[0]ホーム

URL:


Type:Package
Title:Two Event Mark-Recapture Experiment
Version:0.4.4
Date:2021-09-06
Description:Tools are provided for estimating, testing, and simulating abundance in a two-event (Petersen) mark-recapture experiment. Functions are given to calculate the Petersen, Chapman, and Bailey estimators and associated variances. However, the principal utility is a set of functions to simulate random draws from these estimators, and use these to conduct hypothesis tests and power calculations. Additionally, a set of functions are provided for generating confidence intervals via bootstrapping. Functions are also provided to test abundance estimator consistency under complete or partial stratification, and to calculate stratified or partially stratified estimators. Functions are also provided to calculate recommended sample sizes. Referenced methods can be found in Arnason et al. (1996) <ISSN:0706-6457>, Bailey (1951) <doi:10.2307/2332575>, Bailey (1952) <doi:10.2307/1913>, Chapman (1951) NAID:20001644490, Cohen (1988) ISBN:0-12-179060-6, Darroch (1961) <doi:10.2307/2332748>, and Robson and Regier (1964) <ISSN:1548-8659>.
License:GPL-2
Imports:MASS
Suggests:testthat, knitr, rmarkdown
VignetteBuilder:knitr
RoxygenNote:7.1.0
NeedsCompilation:no
Packaged:2021-09-07 21:46:27 UTC; mbtyers
Author:Matt Tyers [aut, cre]
Maintainer:Matt Tyers <matttyersstat@gmail.com>
Repository:CRAN
Date/Publication:2021-09-08 16:00:02 UTC

Estimating, Testing, and Simulating Abundance in a Mark-Recapture Experiment

Description

Tools are provided for estimating, testing, and simulating abundance in a two-event (Petersen) mark-recapture experiment. Functions are given to calculate the Petersen, Chapman, and Bailey estimators and associated variances. However, the principal utility is a set of functions to simulate random draws from these estimators, and use these to conduct hypothesis tests and power calculations. Additionally, a set of functions are provided for generating confidence intervals via bootstrapping. Functions are also provided to test abundance estimator consistency under complete or partial stratification, and to calculate stratified or Darroch estimators. Functions are also provided to calculate recommended sample sizes.

Details

Package: recapr
Type: Package
Version: 0.4.2
Date: 2021-09-02
License: GPL-2

Author(s)

Matt Tyers

Maintainer: Matt Tyers <matttyersstat@gmail.com>


Bailey Estimator

Description

Calculates the value of the Bailey estimator for abundance in amark-recapture experiment, with given values of sample sizes and number ofrecaptures. The Bailey estimator assumes a binomial probability model inthe second sampling event (i.e. sampling with replacement), rather than thehypergeometric model assumed by the Petersen and Chapman estimators.

Usage

NBailey(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The value of the Bailey estimator, calculated as n1*(n2+1)/(m2+1)

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

References

Bailey, N.T.J. (1951). On estimating the size of mobile populations from capture-recapture data.Biometrika38, 293-306.

Bailey, N.T.J. (1952). Improvements in the interpretation of recapture data.J. Animal Ecol.21, 120-7.

See Also

NPetersen,NChapman,vBailey,seBailey,rBailey,pBailey,powBailey,ciBailey

Examples

NBailey(n1=100, n2=100, m2=20)

Chapman Estimator

Description

Calculates the value of the Chapman estimator for abundance in amark-recapture experiment, with given values of sample sizes and number ofrecaptures. The Chapman estimator (Chapman modification of the Petersenestimator) typically outperforms the Petersen estimator, even though thePeterson estimator is the MLE.

Usage

NChapman(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample.This may be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The value of the Chapman estimator, calculated as (n1+1)*(n2+1)/(m2+1) - 1

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

References

Chapman, D.G. (1951). Some properties of the hypergeometric distribution with applications to zoological censuses.Univ. Calif. Public. Stat.1, 131-60.

See Also

NPetersen,NBailey,vChapman,seChapman,rChapman,pChapman,powChapman,ciChapman

Examples

NChapman(n1=100, n2=100, m2=20)

Spatially or Temporally Stratified Abundance Est (Darroch)

Description

Computes abundance estimates and associated variance in the event of spatial or temporal stratification, or in any stratification in which individuals can move between strata. Marking (event 1) and recapture (event 2) strata do not need to be the same.

Inputs are vectors of total event 1 and 2 sample sizes, and either vectors of event 1 and 2 strata corresponding to each recaptured individual, or a matrix of total number of recaptures for each combination of event 1 and event 2 strata.

Implementation is currently using Darroch's method, and will only accept non-singular input matrices.

Usage

NDarroch(  n1counts,  n2counts,  m2strata1 = NULL,  m2strata2 = NULL,  stratamat = NULL)

Arguments

n1counts

A vector of the total sample sizes in the first event, bystrata. For example, settingn1counts=c(20,30,40) would imply 20individuals captured and marked in stratum 1, 30 in stratum 2, and 40 instratum 3.

n2counts

A vector of the total sample sizes in the second event, bystrata.

m2strata1

A vector of the first-event stratum membership of eachrecaptured individual. Only values1, 2, 3, ... are allowed. Maybe used together withm2strata2 instead ofstratamat.

m2strata2

A vector of the second-event stratum membership of eachrecaptured individual. Only values1, 2, 3, ... are allowed. Maybe used together withm2strata1 instead ofstratamat.

stratamat

A matrix specifying the number of recaptures in eachcombination of event 1 and event 2 strata, with rows corresponding to event1 strata and columns corresponding to event 2 strata. May be used insteadofm2strata1 andm2strata2.

Value

A numeric list, giving the strata matrix if originally given in vector form, abundance estimates and standard errors by event 1 and event 2 strata, and the total abundance estimate and standard error.

Author(s)

Matt Tyers

References

Darroch, J.N. (1961). The two-sample capture-recapture census when tagging and sampling are stratified.Biometrika48, 241-60.

See Also

consistencytest

Examples

mat <- matrix(c(59,30,1,45,280,38,0,42,25), nrow=3, ncol=3, byrow=TRUE)NDarroch(n1counts=c(484,1468,399), n2counts=c(847,6616,2489), stratamat=mat)

Petersen Estimator

Description

Calculates the value of the Petersen estimator for abundance ina mark-recapture experiment, with given values of sample sizes and numberof recaptures. The Petersen estimator is the MLE, but is typicallyoutperformed by the Chapman estimator.

Usage

NPetersen(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample.This may be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The value of the Petersen estimator, calculated as n1*n2/m2

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,NBailey,vPetersen,sePetersen,rPetersen,pPetersen,powPetersen,ciPetersen

Examples

NPetersen(n1=100, n2=100, m2=20)

Stratified Abundance Estimator

Description

Calculates the value of the stratified estimator for abundancein a mark-recapture experiment, from vectors of sample sizes and number ofrecaptures, with each element corresponding to each sampling stratum.

Usage

Nstrat(n1, n2, m2, estimator = "Chapman")

Arguments

n1

Vector of individuals captured and marked in the first sample, fromeach stratum

n2

Vector of individuals captured and marked in the second sample,from each stratum

m2

Vector of marked individuals recaptured in the second sample, fromeach stratum

estimator

The type of estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Default to"Chapman".

Value

The value of the stratified estimator

Note

It is possible that even the stratified estimate may be biased ifcapture probabilities differ greatly between strata. However, the bias inthe stratified estimator will be much less than an estimator calculatedwithout stratification.

Author(s)

Matt Tyers

See Also

strattest,rstrat,vstrat,sestrat,cistrat,NChapman,NPetersen,NBailey

Examples

Nstrat(n1=c(100,200), n2=c(100,500), m2=c(10,10))

Confidence Intervals for the Bailey Estimator

Description

Calculates approximate confidence intervals(s) for the Baileyestimator, using bootstrapping, the Normal approximation, or both.

The bootstrap interval is created by resampling the data in the secondsampling event, with replacement; that is, drawing bootstrap values of m2from a binomial distribution with probability parameter m2/n2. Thistechnique has been shown to better approximate the distribution of theabundance estimator. Resulting CI endpoints both have larger values thanthose calculated from a normal distribution, but this better captures thepositive skew of the estimator. Coverage has been investigated by means ofsimulation under numerous scenarios and has consistently outperformed thenormal interval. The user is welcomed to investigate the coverage underrelevant scenarios.

Usage

ciBailey(n1, n2, m2, conf = 0.95, method = "both", bootreps = 10000)

Arguments

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of marked individuals recaptured in the second sample

conf

The confidence level of the desired intervals. Defaults to 0.95.

method

Which method of confidence interval to return. Allowed valuesare"norm","boot", or"both". Defaults to"both".

bootreps

Number of bootstrap replicates to use. Defaults to 10000.

Value

A list with the abundance estimate and confidence interval bounds forthe normal-distribution and/or bootstrap confidence intervals.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,vBailey,seBailey,rBailey,pBailey,powBailey

Examples

ciBailey(n1=100, n2=100, m2=20)

Confidence Intervals for the Chapman Estimator

Description

Calculates approximate confidence intervals(s) for the Chapmanestimator, using bootstrapping, the Normal approximation, or both.

The bootstrap interval is created by resampling the data in the secondsampling event, with replacement; that is, drawing bootstrap values of m2from a binomial distribution with probability parameter m2/n2. Thistechnique has been shown to better approximate the distribution of theabundance estimator. Resulting CI endpoints both have larger values thanthose calculated from a normal distribution, but this better captures thepositive skew of the estimator. Coverage has been investigated by means ofsimulation under numerous scenarios and has consistently outperformed thenormal interval. The user is welcomed to investigate the coverage underrelevant scenarios.

Usage

ciChapman(n1, n2, m2, conf = 0.95, method = "both", bootreps = 10000)

Arguments

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of marked individuals recaptured in the second sample

conf

The confidence level of the desired intervals. Defaults to 0.95.

method

Which method of confidence interval to return. Allowed valuesare"norm","boot", or"both". Defaults to"both".

bootreps

Number of bootstrap replicates to use. Defaults to 10000.

Value

A list with the abundance estimate and confidence interval bounds forthe normal-distribution and/or bootstrap confidence intervals.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,vChapman,seChapman,rChapman,pChapman,powChapman

Examples

ciChapman(n1=100, n2=100, m2=20)

Confidence Intervals for the Petersen Estimator

Description

Calculates approximate confidence intervals(s) for the Petersenestimator, using bootstrapping, the Normal approximation, or both.

The bootstrap interval is created by resampling the data in the secondsampling event, with replacement; that is, drawing bootstrap values of m2from a binomial distribution with probability parameter m2/n2. Thistechnique has been shown to better approximate the distribution of theabundance estimator. Resulting CI endpoints both have larger values thanthose calculated from a normal distribution, but this better captures thepositive skew of the estimator. Coverage has been investigated by means ofsimulation under numerous scenarios and has consistently outperformed thenormal interval. The user is welcomed to investigate the coverage underrelevant scenarios.

Usage

ciPetersen(  n1,  n2,  m2,  conf = 0.95,  method = "both",  bootreps = 10000,  useChapvar = FALSE)

Arguments

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of marked individuals recaptured in the second sample

conf

The confidence level of the desired intervals. Defaults to 0.95.

method

Which method of confidence interval to return. Allowed valuesare"norm","boot", or"both". Defaults to"both".

bootreps

Number of bootstrap replicates to use. Defaults to 10000.

useChapvar

Whether to use the Chapman estimator variance instead ofthe Petersen estimator variance for the normal-distribution interval.Defaults toFALSE.

Value

A list with the abundance estimate and confidence interval bounds forthe normal-distribution and/or bootstrap confidence intervals.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,vPetersen,sePetersen,rPetersen,pPetersen,powPetersen

Examples

ciPetersen(n1=100, n2=100, m2=20)

Confidence Intervals for the Stratified Estimator

Description

Calculates approximate confidence intervals(s) for theStratified estimator, using bootstrapping, the Normal approximation, orboth.

The bootstrap interval is created by resampling the data in the secondsampling event, with replacement for each stratum; that is, drawingbootstrap values of m2 from a binomial distribution with probabilityparameter m2/n2.

Usage

cistrat(  n1,  n2,  m2,  conf = 0.95,  method = "both",  bootreps = 10000,  estimator = "Chapman",  useChapvar = FALSE)

Arguments

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of marked individuals recaptured in the second sample

conf

The confidence level of the desired intervals. Defaults to 0.95.

method

Which method of confidence interval to return. Allowed valuesare"norm","boot", or"both". Defaults to"both".

bootreps

Number of bootstrap replicates to use. Defaults to 10000.

estimator

The type of estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Default to"Chapman".

useChapvar

Whether to use the Chapman estimator variance instead ofthe Petersen estimator variance for the normal-distribution interval, if"method" is set to"Petersen". Defaults toFALSE.

Value

A list with the abundance estimate and confidence interval bounds forthe normal-distribution and/or bootstrap confidence intervals.

Note

Both the bootstrap and the normal approximation intervals make thenaive assumption of independence between strata, which may not be the case.The user therefore cautioned, and is encouraged to investigate the coverageunder relevant scenarios.

Author(s)

Matt Tyers

See Also

\linkstrattest,Nstrat,rstrat,vstrat,sestrat,NChapman,NPetersen,NBailey

Examples

cistrat(n1=c(100,200), n2=c(100,500), m2=c(10,10))

Consistency Tests for the Abundance Estimator, Partial Stratification

Description

Conducts three chi-squared tests for the consistency of thePetersen-type abundance estimator. These tests explore evidenceagainst the second traditional assumption of the Petersen mark-recaptureexperiment: that equal capture probabilities exist in either the first orsecond sampling event, or that complete mixing occurs between events.

Typically, if any of these test p-values is greater than the significancelevel, use of a Petersen-type estimator is considered justified. If allthree tests give p-values below the significance level and no movementoccurs between strata (and strata are the same between events), astratified estimator may be used. If all three tests give p-values belowthe significance level and some movement between strata occurs, a partiallystratified (Darroch-type) estimator must be used, such asNDarroch.

This function assumes stratification in both sampling events, and indifferent ways (by time, area, etc.) If stratification was the same inboth events such that individuals could not move from one strata to another(such as by size or gender), use ofstrattest is recommended.

Usage

consistencytest(  n1,  n2,  m2strata1 = NULL,  m2strata2 = NULL,  stratamat = NULL,  ...)

Arguments

n1

A vector of the total sample sizes in the first event, bystrata. For example, settingn1=c(20,30,40) would imply 20individuals captured and marked in stratum 1, 30 in stratum 2, and 40 instratum 3.

n2

A vector of the total sample sizes in the second event, bystrata.

m2strata1

A vector of the first-event stratum membership of eachrecaptured individual. Only values1, 2, 3, ... are allowed. Maybe used together withm2strata2 instead ofstratamat.

m2strata2

A vector of the second-event stratum membership of eachrecaptured individual. Only values1, 2, 3, ... are allowed. Maybe used together withm2strata1 instead ofstratamat.

stratamat

A matrix specifying the number of recaptures in eachcombination of event 1 and event 2 strata, with rows corresponding to event1 strata and columns corresponding to event 2 strata. May be used insteadofm2strata1 andm2strata2.

...

Additional arguments forchisq.test

Value

A list of class"recapr_consistencytest" with the following components:

Note

Naming conventions for the second and third tests are taken from SPAS (see reference)

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

References

Stratified Population Analysis System (Arnason, A.N., C.W. Kirby, C.J. Schwarzand J.R. Irvine. 1996. Computer Analysis of Data from Stratified Mark-Recovery Experimentsfor Estimation of Salmon Escapements and Other Populations, Canadian Technical Report ofFisheries and Aquatic Sciences 2106).

See Also

strattest,NDarroch

Examples

consistencytest(n1=c(15,12,6), n2=c(12,9,10,8),   m2strata1=c(1,1,1,1,1,2,2,2,3,3),   m2strata2=c(1,1,3,3,4,1,2,4,1,3),   simulate.p.value=TRUE)mat <- matrix(c(30,15,1,0,22,15), nrow=2, ncol=3, byrow=TRUE)consistencytest(n1=c(284,199), n2=c(347,3616,1489), stratamat=mat)

Mark-Recapture Sample Size, Robson-Regier

Description

Calculates minimum sample size for one sampling event in aPetersen mark-recapture experiment, given the sample size in the otherevent and an best guess at true abundance.

Usage

n2RR(  N,  n1,  conf = c(0.99, 0.95, 0.9, 0.85, 0.8, 0.75),  acc = c(0.5, 0.25, 0.2, 0.15, 0.1, 0.05, 0.01))

Arguments

N

The best guess at true abundance

n1

The size of the first (or second) sampling event

conf

A vector of the desired levels of confidence to investigate.Allowed values are any ofc(0.99,0.95,0.9,0.85,0.8,0.75). Defaults toall ofc(0.99,0.95,0.85,0.8,0.75).

acc

A vector of the desired levels of relative accuracy toinvestigate. Allowed values are any ofc(0.5,0.25,0.2,0.15,0.1,0.05,0.01). Defaults to all ofc(0.5,0.25,0.2,0.15,0.1,0.05,0.01).

Value

A list of minimum sample sizes. Each list element corresponds to aunique level of confidence, and is defined as a data frame with each rowcorresponding to a unique value of relative accuracy. Two minimum samplesizes are given: one calculated from the sample size provided for the otherevent, and the other calculated under n1=n2, the most efficient scenario.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

It is possible that the sample size - accuracy relationship will be better illustrated usingplotn2sim.

Author(s)

Matt Tyers

References

Robson, D. S., and H. A. Regier. 1964. Sample size in Petersenmark-recapture experiments. Transactions of the American FisheriesSociety93:215-226.

See Also

plotn2sim,plotn1n2simmatrix

Examples

n2RR(N=1000, n1=100)

Hypothesis Testing Using the Bailey Estimator

Description

Approximates a p-value for a hypothesis test of the Baileyestimator by means of many simulated draws from the null distribution, conditioned on sample sizes.

Usage

pBailey(  estN = NULL,  nullN,  n1,  n2,  m2 = NULL,  nsim = 1e+05,  alternative = "less")

Arguments

estN

The estimated abundance. Either this or the number of recaptures(m2) must be specified.

nullN

The abundance given by the null hypothesis

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of recaptures. Either this or the estimated abundance(estN) must be specified.

nsim

Number of simulated values to draw. Defaults to 100000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

An approximate p-value for the specified hypothesis test. Ifm2 is specified rather thanestN, output will be returned asa list with two elements: the estimated abundance and p-value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,vBailey,seBailey,rBailey,powBailey,ciBailey

Examples

output <- pBailey(nullN=500, n1=100, n2=100, m2=28)outputplotdiscdensity(rBailey(length=100000, N=500, n1=100, n2=100))abline(v=output$estN, lwd=2, col=2)abline(v=500, lwd=2, lty=2)output <- pBailey(nullN=500, n1=100, n2=100, m2=28, alternative="2-sided")outputplotdiscdensity(rBailey(length=100000, N=500, n1=100, n2=100))twosided <- 500 + c(-1,1)*abs(500-output$estN)abline(v=twosided, lwd=2, col=2)abline(v=500, lwd=2, lty=2)

Hypothesis Testing Using the Chapman Estimator

Description

Approximates a p-value for a hypothesis test of the Chapmanestimator by means of many simulated draws from the null distribution, conditioned on sample sizes.

Usage

pChapman(  estN = NULL,  nullN,  n1,  n2,  m2 = NULL,  nsim = 1e+05,  alternative = "less")

Arguments

estN

The estimated abundance. Either this or the number of recaptures(m2) must be specified.

nullN

The abundance given by the null hypothesis

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of recaptures. Either this or the estimated abundance(estN) must be specified.

nsim

Number of simulated values to draw. Defaults to 100000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

An approximate p-value for the specified hypothesis test. Ifm2 is specified rather thanestN, output will be returned asa list with two elements: the estimated abundance and p-value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,vChapman,seChapman,rChapman,powChapman,ciChapman

Examples

output <- pChapman(nullN=500, n1=100, n2=100, m2=28)outputplotdiscdensity(rChapman(length=100000, N=500, n1=100, n2=100))abline(v=output$estN, lwd=2, col=2)abline(v=500, lwd=2, lty=2)output <- pChapman(nullN=500, n1=100, n2=100, m2=28, alternative="2-sided")outputplotdiscdensity(rChapman(length=100000, N=500, n1=100, n2=100))twosided <- 500 + c(-1,1)*abs(500-output$estN)abline(v=twosided, lwd=2, col=2)abline(v=500, lwd=2, lty=2)

Hypothesis Testing Using the Petersen Estimator

Description

Approximates a p-value for a hypothesis test of the Petersenestimator by means of many simulated draws from the null distribution, conditioned on sample sizes.

Usage

pPetersen(  estN = NULL,  nullN,  n1,  n2,  m2 = NULL,  nsim = 1e+05,  alternative = "less")

Arguments

estN

The estimated abundance. Either this or the number of recaptures(m2) must be specified.

nullN

The abundance given by the null hypothesis

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

m2

Number of recaptures. Either this or the estimated abundance(estN) must be specified.

nsim

Number of simulated values to draw. Defaults to 100000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

An approximate p-value for the specified hypothesis test. Ifm2 is specified rather thanestN, output will be returned asa list with two elements: the estimated abundance and p-value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,vPetersen,sePetersen,rPetersen,powPetersen,ciPetersen

Examples

output <- pPetersen(nullN=500, n1=100, n2=100, m2=28)outputplotdiscdensity(rPetersen(length=100000, N=500, n1=100, n2=100))abline(v=output$estN, lwd=2, col=2)abline(v=500, lwd=2, lty=2)output <- pPetersen(nullN=500, n1=100, n2=100, m2=28, alternative="2-sided")outputplotdiscdensity(rPetersen(length=100000, N=500, n1=100, n2=100))twosided <- 500 + c(-1,1)*abs(500-output$estN)abline(v=twosided, lwd=2, col=2)abline(v=500, lwd=2, lty=2)

Plotting the Density of a Vector of Discrete Values

Description

Plots the empirical density of a vector of discrete values, approximating the probability mass function (pmf). This can be considered a more appropriate alternative toplot(density(x)) in the case of a vector with a discrete (non-continuous) support, such as that calculated by an abundance estimator.

Usage

plotdiscdensity(x, xlab = "value", ylab = "density", ...)

Arguments

x

The vector of values to plot

xlab

The X-axis label for plotting

ylab

The Y-axis label for plotting

...

Additional plotting arguments

Author(s)

Matt Tyers

Examples

draws <- rChapman(length=100000, N=500, n1=100, n2=100)plotdiscdensity(draws)  #plots the density of a vector of discrete values

Mark-Recapture Sample Size Via Sim, Both Samples

Description

Produces a plot of the simulated relative accuracy of amark-recapture abundance estimator for various sample sizes in both events. This may be auseful exploration, but it is possible thatplotn2sim may be more informative.

Usage

plotn1n2simmatrix(  N,  conf = 0.95,  nrange = NULL,  nstep = NULL,  estimator = "Chapman",  nsim = 10000,  ...)

Arguments

N

The best guess at true abundance

conf

The desired level of confidence to investigate.Defaults to 0.95.

nrange

A two-element vector describing the range of sample sizes toinvestigate. If the default (NULL) is accepted, an appropriatevalue will be chosen.

nstep

The step size between sample sizes to investigate. If thedefault (NULL) is accepted, an appropriate value will be chosen.

estimator

The abundance estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Defaults to"Chapman".

nsim

The number of replicates. Defaults to 10000.

...

Additional plotting parameters

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

n2RR,plotn2sim

Examples

plotn1n2simmatrix(N=10000, nsim=2000)

Mark-Recapture Sample Size Via Simulation

Description

Produces a plot of the simulated relative accuracy of amark-recapture abundance estimator for various sample sizes. This may be abetter representation of the sample size - accuracy relationship than thatprovided byn2RR.

Usage

plotn2sim(  N,  n1,  conf = c(0.99, 0.95, 0.85, 0.8, 0.75),  n2range = NULL,  n2step = NULL,  estimator = "Chapman",  nsim = 10000,  accrange = 1,  ...)

Arguments

N

The best guess at true abundance

n1

The size of the first (or second) sampling event

conf

A vector of the desired levels of confidence to investigate.Allowed values are any ofc(0.99,0.95,0.85,0.8,0.75). Defaults toall ofc(0.99,0.95,0.85,0.8,0.75).

n2range

A two-element vector describing the range of sample sizes toinvestigate. If the default (NULL) is accepted, an appropriatevalue will be chosen.

n2step

The step size between sample sizes to investigate. If thedefault (NULL) is accepted, an appropriate value will be chosen.

estimator

The abundance estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Defaults to"Chapman".

nsim

The number of replicates. Defaults to 10000.

accrange

The maximum level of relative accuracy for plotting.Defaults to 1.

...

Additional plotting parameters

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

n2RR,plotn1n2simmatrix

Examples

plotn2sim(N=1000, n1=100)

Power for Hypothesis Testing Using the Bailey Estimator

Description

Approximates the power of a hypothesis test of the Baileyestimator by means of many simulated draws from a specified alternative distribution, conditioned on sample sizes.

Usage

powBailey(  nullN,  trueN,  n1,  n2,  alpha = 0.05,  nsim = 10000,  alternative = "less")

Arguments

nullN

The abundance given by the null hypothesis

trueN

The assumed abundance for the power calculation

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

alpha

The alpha level for the test

nsim

Number of simulated values to draw. Defaults to 10000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

The approximate power of the specified hypothesis test, for the specified alternative value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,vBailey,seBailey,rBailey,pBailey,ciBailey

Examples

powBailey(nullN=500, trueN=400, n1=100, n2=100, nsim=1000)Ntotry <- seq(from=250, to=450, by=25)pows <- sapply(Ntotry, function(x)  powBailey(nullN=500, trueN=x, n1=100, n2=100, nsim=1000))plot(Ntotry, pows)

Power for Hypothesis Testing Using the Chapman Estimator

Description

Approximates the power of a hypothesis test of the Chapmanestimator by means of many simulated draws from a specified alternative distribution, conditioned on sample sizes.

Usage

powChapman(  nullN,  trueN,  n1,  n2,  alpha = 0.05,  nsim = 10000,  alternative = "less")

Arguments

nullN

The abundance given by the null hypothesis

trueN

The assumed abundance for the power calculation

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

alpha

The alpha level for the test

nsim

Number of simulated values to draw. Defaults to 10000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

The approximate power of the specified hypothesis test, for the specified alternative value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,vChapman,seChapman,rChapman,pChapman,ciChapman

Examples

powChapman(nullN=500, trueN=400, n1=100, n2=100, nsim=1000)Ntotry <- seq(from=250, to=450, by=25)pows <- sapply(Ntotry, function(x)  powChapman(nullN=500, trueN=x, n1=100, n2=100, nsim=1000))plot(Ntotry, pows)

Power for Hypothesis Testing Using the Petersen Estimator

Description

Approximates the power of a hypothesis test of the Petersenestimator by means of many simulated draws from a specified alternative distribution, conditioned on sample sizes.

Usage

powPetersen(  nullN,  trueN,  n1,  n2,  alpha = 0.05,  nsim = 10000,  alternative = "less")

Arguments

nullN

The abundance given by the null hypothesis

trueN

The assumed abundance for the power calculation

n1

Number of individuals captured and marked in the first sample

n2

Number of individuals captured in the second sample

alpha

The alpha level for the test

nsim

Number of simulated values to draw. Defaults to 10000.

alternative

Direction of the alternative hypothesis. Allowed valuesare"less","greater", or"2-sided". Defaults to"less".

Value

The approximate power of the specified hypothesis test, for the specified alternative value.

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,vPetersen,sePetersen,rPetersen,pPetersen,ciPetersen

Examples

powPetersen(nullN=500, trueN=400, n1=100, n2=100, nsim=1000)Ntotry <- seq(from=250, to=450, by=25)pows <- sapply(Ntotry, function(x)  powPetersen(nullN=500, trueN=x, n1=100, n2=100, nsim=1000))plot(Ntotry, pows)

Power of Consistency Tests, Partial Stratification

Description

Conducts power calculations of the chi-squared tests for theconsistency of the Petersen-type abundance estimator, in a partialstratification setting, such as by time or geographic area. In the case ofpartial stratification, individuals may move from one stratum to anotherbetween the first and second sampling events, and strata do not need to bethe 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, withrows corresponding to first-event strata and columns corresponding tosecond-event strata, and an additional column corresponding to theprobability of NOT being recaptured in the second event. Values will bestandardized by row, that is, by first-event strata. See note on usagebelow.

alpha

Significance level for testing. Defaults to0.05

sim

Whether to conduct power calculation by simulation as well asCohen's method. Defaults toTRUE.

nsim

Number of simulations ifsim isTRUE. Defaults to10000.

Value

An object of class"recapr_consistencypow" with the followingcomponents:

Note

The movement probability matrix specified inpmat is consideredconditional on each row, that is, first-event strata, with columnscorresponding to second-event strata and the final column specifying theprobability of not being recaptured in the second event. Values do notneed to sum to one for each row, but will be standardized by the functionto sum to one.

Apmat with a first row equal to(0.05, 0.1, 0.15, 0.7) wouldimply a 5 percent chance that individuals captured in the first-eventstrata 1 will be recaptured in second-event strata 1, and a 70 percentchance that individuals captured in the first-event strata 1 will not berecaptured 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 behavioralsciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.

Code adapted from the 'pwr' package: Stephane Champely (2015). pwr: BasicFunctions 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)

Power of Consistency Tests, Complete Stratification

Description

Conducts power calculations of the chi-squared tests for theconsistency of the Petersen-type abundance estimator, in a completestratification setting.

Usage

powstrattest(N, n1, n2, alpha = 0.05, sim = TRUE, nsim = 1e+05)

Arguments

N

Vector of total abundance, with each element corresponding to onestratum.

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.

alpha

Significance level for testing. Defaults to0.05

sim

Whether to conduct power calculation by simulation as well asCohen's method. Defaults toTRUE.

nsim

Number of simulations ifsim isTRUE. Defaults to100000.

Value

A list of three elements, each with class"recapr_stratpow"with the following components:

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. Rpackage version 1.1-3. https://CRAN.R-project.org/package=pwr

See Also

strattest,Nstrat

Examples

powstrattest(N=c(10000,20000), n1=c(1000,2000), n2=c(200,200))

Print method for consistency test power

Description

Print method for consistency test power

Usage

## S3 method for class 'recapr_consistencypow'print(x, ...)

Arguments

x

Output frompowconsistencytest()

...

additional print arguments

Author(s)

Matt Tyers


Print method for consistency test

Description

Print method for consistency test

Usage

## S3 method for class 'recapr_consistencytest'print(x, ...)

Arguments

x

Output fromconsistencytest()

...

additional print arguments

Author(s)

Matt Tyers


Print method for stratification test power

Description

Print method for stratification test power

Usage

## S3 method for class 'recapr_stratpow'print(x, ...)

Arguments

x

Output frompowstrattest()

...

additional print arguments

Author(s)

Matt Tyers


Print method for stratification test

Description

Print method for stratification test

Usage

## S3 method for class 'recapr_strattest'print(x, ...)

Arguments

x

Output fromstrattest()

...

additional print arguments

Author(s)

Matt Tyers


Random Draws from the Bailey Estimator

Description

Returns a vector of random draws from the Bailey estimator in amark-recapture experiment, given values of the true abundance and thesample size in both events. The function first simulates a vector ofrecaptures (m2) from a binomial distribution, and then uses these tocompute a vector of draws from the estimator.

If capture probabilities (p1 and/orp2) are specified instead of sample size(s), the sample size(s) will first be drawn from a binomial distribution, then the number of recaptures. If both sample size and capture probability are specified for a given sampling event, only the sample size will be used.

Usage

rBailey(length, N, n1 = NULL, n2 = NULL, p1 = NULL, p2 = NULL)

Arguments

length

The length of the random vector to return.

N

The value of the true abundance. This may be a single number orvector of values equal tolength.

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values equal tolength.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values equal tolength.

p1

Alternately, probability of capture in the first sample. Thismay be a single number or vector of values equal tolength.

p2

Alternately, probability of capture in the second sample. This may be asingle number or vector of values equal tolength.

Value

A vector of random draws from the Bailey estimator

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,vBailey,seBailey,pBailey,powBailey,ciBailey

Examples

draws <- rBailey(length=100000, N=500, n1=100, n2=100)plotdiscdensity(draws)  #plots the density of a vector of discrete values

Random Draws from the Chapman Estimator

Description

Returns a vector of random draws from the Chapman estimator in amark-recapture experiment, given values of the true abundance and thesample size in both events. The function first simulates a vector ofrecaptures (m2) from a hypergeometric distribution, and then uses these tocompute a vector of draws from the estimator.

If capture probabilities (p1 and/orp2) are specified instead of sample size(s), the sample size(s) will first be drawn from a binomial distribution, then the number of recaptures. If both sample size and capture probability are specified for a given sampling event, only the sample size will be used.

Usage

rChapman(length, N, n1 = NULL, n2 = NULL, p1 = NULL, p2 = NULL)

Arguments

length

The length of the random vector to return.

N

The value of the true abundance. This may be a single number orvector of values equal tolength.

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values equal tolength.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values equal tolength.

p1

Alternately, probability of capture in the first sample. Thismay be a single number or vector of values equal tolength.

p2

Alternately, probability of capture in the second sample. This may be asingle number or vector of values equal tolength.

Value

A vector of random draws from the Chapman estimator

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,vChapman,seChapman,pChapman,powChapman,ciChapman

Examples

draws <- rChapman(length=100000, N=500, n1=100, n2=100)plotdiscdensity(draws)  #plots the density of a vector of discrete values

Random Draws from the Petersen Estimator

Description

Returns a vector of random draws from the Petersen estimator in amark-recapture experiment, given values of the true abundance and thesample size in both events. The function first simulates a vector ofrecaptures (m2) from a hypergeometric distribution, and then uses these tocompute a vector of draws from the estimator.

If capture probabilities (p1 and/orp2) are specified instead of sample size(s), the sample size(s) will first be drawn from a binomial distribution, then the number of recaptures. If both sample size and capture probability are specified for a given sampling event, only the sample size will be used.

Usage

rPetersen(length, N, n1 = NULL, n2 = NULL, p1 = NULL, p2 = NULL)

Arguments

length

The length of the random vector to return.

N

The value of the true abundance. This may be a single number orvector of values equal tolength.

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values equal tolength.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values equal tolength.

p1

Alternately, probability of capture in the first sample. Thismay be a single number or vector of values equal tolength.

p2

Alternately, probability of capture in the second sample. This may be asingle number or vector of values equal tolength.

Value

A vector of random draws from the Petersen estimator

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,vPetersen,sePetersen,pPetersen,powPetersen,ciPetersen

Examples

draws <- rPetersen(length=100000, N=500, n1=100, n2=100)plotdiscdensity(draws)  #plots the density of a vector of discrete values

Random Draws from the Stratified Estimator

Description

Returns a vector of random draws from the stratified estimator in amark-recapture experiment, given values of the true abundance and thesample size in both events. The function first simulates a vector ofrecaptures (m2) for each stratum, and then uses these tocompute a vector of draws from the estimator.

It may prove useful to investigate the behavior of the stratified estimator under relevant scenarios.

If capture probabilities (p1 and/orp2) are specified instead of sample size(s), the sample size(s) will first be drawn from a binomial distribution, then the number of recaptures. If both sample size and capture probability are specified for a given sampling event, only the sample size will be used.

Usage

rstrat(  length,  N,  n1 = NULL,  n2 = NULL,  p1 = NULL,  p2 = NULL,  estimator = "Chapman")

Arguments

length

The length of the random vector to return.

N

A vector of values of the true abundance for each stratum.

n1

A vector of the number of individuals captured and marked in the first sample, for each stratum.

n2

A vector of the number of individuals captured in the second sample, for each stratum.

p1

Alternately, a vector of probabilities of capture for the first event, for each stratum.

p2

Alternately, a vector of probabilities of capture for the second event, for each stratum.

estimator

The type of estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Default to"Chapman".

Value

A vector of random draws from the stratified estimator

Author(s)

Matt Tyers

See Also

strattest,Nstrat,vstrat,cistrat,NChapman,NPetersen,NBailey

Examples

draws <- rstrat(length=100000, N=c(5000,10000), n1=c(500,200), n2=c(500,200))plotdiscdensity(draws)  #plots the density of a vector of discrete valuesmean(draws)

Standard Error of the Bailey Estimator

Description

Calculates the standard error of the Bailey estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

seBailey(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Bailey estimator, calculated assqrt((n1^2)*(n2+1)*(n2-m2)/(m2+1)/(m2+1)/(m2+2))

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,vBailey,rBailey,pBailey,powBailey,ciBailey

Examples

seBailey(n1=100, n2=100, m2=20)

Standard Error of the Chapman Estimator

Description

Calculates the standard error of the Chapman estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

seChapman(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Chapman estimator, calculated assqrt((n1+1)*(n2+1)*(n1-m2)*(n2-m2)/((m2+2)*(m2+1)^2))

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,vChapman,rChapman,pChapman,powChapman,ciChapman

Examples

seChapman(n1=100, n2=100, m2=20)

Standard Error of the Petersen Estimator

Description

Calculates the standard error of the Petersen estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

sePetersen(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Petersen estimator, calculated assqrt((n1^2)*n2*(n2-m2)/(m2^3))

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,vPetersen,rPetersen,pPetersen,powPetersen,ciPetersen

Examples

sePetersen(n1=100, n2=100, m2=20)

Standard Error of Stratified Abundance Estimator

Description

Calculates the standard error of the stratified estimator forabundance in a mark-recapture experiment, from vectors of sample sizes andnumber of recaptures, with each element corresponding to each samplingstratum.

Usage

sestrat(n1, n2, m2, estimator = "Chapman")

Arguments

n1

Vector of individuals captured and marked in the first sample, fromeach stratum

n2

Vector of individuals captured and marked in the second sample,from each stratum

m2

Vector of marked individuals recaptured in the second sample, fromeach stratum

estimator

The type of estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Default to"Chapman".

Value

The standard error of the stratified estimator

Note

It is possible that even the stratified estimate of abundance may bebiased if capture probabilities differ greatly between strata. However,the bias in the stratified estimator will be much less than an estimatorcalculated without stratification.

This function makes the naive assumption of independence betweenstrata. Caution is therefore recommended.

Author(s)

Matt Tyers

See Also

strattest,Nstrat,rstrat,vstrat,cistrat,NChapman,NPetersen,NBailey

Examples

sestrat(n1=c(100,200), n2=c(100,500), m2=c(10,10))

Consistency Tests for the Abundance Estimator, Complete Stratification

Description

Conducts two chi-squared tests for the consistency of thePetersen-type abundance estimator. These tests provide explore evidenceagainst equal capture probabilities in either the first or second samplingevent. Also conducts a third chi-squared test of unequal captureprobabilities between sampling events for each stratum, in the case ofsmall sample sizes (fewer than 100 in either sampling event and fewer than30 recaptures), which may be used to suggest unequal capture probabilitiesin either the first or second event.

Typically, if either of the first two test p-values is greater than thesignificance level, use of a Petersen-type estimator is consideredjustified.

If tests give evidence of unequal capture probabilities between strata, astratified estimator should be used, such asNstrat.

This function assumes stratification in both sampling events, such thatindividuals cannot move from one strata to another (such as by size orgender). If movement between strata may occur (such as in the case ofstratification by time or area), use ofconsistencytest isrecommended.

Usage

strattest(n1, n2, m2, ...)

Arguments

n1

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

n2

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

m2

Vector of m2 counts (number of recaptures in the second event),each element corresponding to one stratum.

...

Additional arguments forchisq.test

Value

A list of class"recapr_strattest" with the followingcomponents:

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

powstrattest,Nstrat,consistencytest

Examples

strattest(n1=c(100,100), n2=c(50,200), m2=c(20,15))

Estimated Variance of the Bailey Estimator

Description

Calculates the estimated variance of the Bailey estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

vBailey(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Bailey estimator, calculated as(n1^2)*(n2+1)*(n2-m2)/(m2+1)/(m2+1)/(m2+2)

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NBailey,seBailey,rBailey,pBailey,powBailey,ciBailey

Examples

vBailey(n1=100, n2=100, m2=20)

Estimated Variance of the Chapman Estimator

Description

Calculates the estimated variance of the Chapman estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

vChapman(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Chapman estimator, calculated as(n1+1)*(n2+1)*(n1-m2)*(n2-m2)/((m2+2)*(m2+1)^2)

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NChapman,seChapman,rChapman,pChapman,powChapman,ciChapman

Examples

vChapman(n1=100, n2=100, m2=20)

Estimated Variance of the Petersen Estimator

Description

Calculates the estimated variance of the Petersen estimator in amark-recapture experiment, with given values of sample sizes and number ofrecaptures.

Usage

vPetersen(n1, n2, m2)

Arguments

n1

Number of individuals captured and marked in the first sample. Thismay be a single number or vector of values.

n2

Number of individuals captured in the second sample. This may be asingle number or vector of values.

m2

Number of marked individuals recaptured in the second sample. Thismay be a single number or vector of values.

Value

The estimate variance of the Petersen estimator, calculated as(n1^2)*n2*(n2-m2)/(m2^3)

Note

Any Petersen-type estimator (such as this) depends on a set ofassumptions:

Author(s)

Matt Tyers

See Also

NPetersen,sePetersen,rPetersen,pPetersen,powPetersen,ciPetersen

Examples

vPetersen(n1=100, n2=100, m2=20)

Estimated Variance of Stratified Abundance Estimator

Description

Calculates the estimated variance of the stratified estimatorfor abundance in a mark-recapture experiment, from vectors of sample sizesand number of recaptures, with each element corresponding to each samplingstratum.

Usage

vstrat(n1, n2, m2, estimator = "Chapman")

Arguments

n1

Vector of individuals captured and marked in the first sample, fromeach stratum

n2

Vector of individuals captured and marked in the second sample,from each stratum

m2

Vector of marked individuals recaptured in the second sample, fromeach stratum

estimator

The type of estimator to use. Allowed values are"Chapman","Petersen", and"Bailey". Default to"Chapman".

Value

The estimated variance of the stratified estimator

Note

It is possible that even the stratified estimate of abundance may bebiased if capture probabilities differ greatly between strata. However,the bias in the stratified estimator will be much less than an estimatorcalculated without stratification.

This function makes the naive assumption of independence betweenstrata. Caution is therefore recommended.

Author(s)

Matt Tyers

See Also

strattest,Nstrat,rstrat,sestrat,cistrat,NChapman,NPetersen,NBailey

Examples

vstrat(n1=c(100,200), n2=c(100,500), m2=c(10,10))

[8]ページ先頭

©2009-2025 Movatter.jp