recapr (version 0.4.3)

pChapman: Hypothesis Testing Using the Chapman Estimator

Description

Approximates a p-value for a hypothesis test of the Chapman estimator 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 values are "less", "greater", or "2-sided". Defaults to "less".

Value

An approximate p-value for the specified hypothesis test. If m2 is specified rather than estN, output will be returned as a list with two elements: the estimated abundance and p-value.

See Also

NChapman, vChapman, seChapman, rChapman, powChapman, ciChapman

Examples

Run this code
# NOT RUN {
output <- pChapman(nullN=500, n1=100, n2=100, m2=28)
output

plotdiscdensity(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")
output

plotdiscdensity(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)
# }

Run the code above in your browser using DataLab