n1_n2_m2_to_cap_hist: Convert n1, n2, m2 to capture history data for use in...

View source: R/n1_n2_m2_to_cap_hist.R

n1_n2_m2_to_cap_histR Documentation

Convert n1, n2, m2 to capture history data for use in estimating. Vectors are transformed to strata.

Description

Convert n1, n2, m2 to capture history data for use in estimating. Vectors are transformed to strata.

Usage

n1_n2_m2_to_cap_hist(
  n1,
  n2,
  m2,
  strata = paste0("Stratum_", 1:length(m2)),
  stratum_var = "Stratum"
)

Arguments

n1

Number of animals marked and released. If a vector, there are the numbers in each stratum

n2

Number of animals examined for marks.

m2

Number of marked animals from n1 seen in n2.

strata

Stratum labels. Added to the data frame if n1, n2, m2 are vectors.

stratum_var

Name of variable to contain stratum labels.

Value

A data frame with the capture history, frequency.

  • cap_hist Capture history (see details below)

  • freq Number of times this capture history was observed

If the inputs are vectors, a stratum variable is also added.

Author(s)

Schwarz, C. J. cschwarz.stat.sfu.ca@gmail.com.

Examples


# Rodli Tarn n1=109, n2=177, m2=57
cap_hist <- n1_n2_m2_to_cap_hist(n1=109, n2=177, m2=57)
cap_hist
fit <- Petersen::LP_fit(data=cap_hist, p_model=~..time)
fit$summary
# Now to get the estimated abundance
est <- Petersen::LP_est(fit, N_hat=~1)
est$summary

#stratified example - Northern Pike stratified by sex
cap_hist <- n1_n2_m2_to_cap_hist(n1=c(4045,2777), n2=c(613,527), m2=c(89,68),
                strata=c("F","M"),stratum_var="Sex")
cap_hist


Petersen documentation built on April 4, 2025, 3:05 a.m.