lcmCR: Bayesian Nonparametric Latent Class Capture-Recapture

View source: R/Lcm_CR_fn.R

lcmCRR Documentation

Bayesian Nonparametric Latent Class Capture-Recapture

Description

Create and initialize an object of class lcm_CR_Basic.

Usage

lcmCR(captures, tabular = FALSE, in_list_label = "1", not_in_list_label = "0", 
  K = 5, a_alpha = 0.25, b_alpha = 0.25, buffer_size = 10000, thinning = 10, 
  seed = "auto", verbose = TRUE)

Arguments

captures

input dataset. A data frame with the multiple-recapture data. See 'Details' for input formats.

tabular

a logical value indicating whether or not the data is tabulated. See 'Details'.

in_list_label

factor label that indicates that individual is in list (e.g. 'Yes')

not_in_list_label

factor label that indicates that individual is in not list (e.g. 'No')

K

maximum number of latent classes. Indicates the truncation level of the stick-breaking process.

a_alpha

shape parameter of the prior distribution of concentration parameter of the stick-breaking process.

b_alpha

inverse scale parameter of the prior distribution of concentration parameter of the stick-breaking process.

buffer_size

size of the tracing buffer.

thinning

thinning interval for the tracing buffer

seed

integer seed of the internal RNG.

verbose

Generate progress messages?

Details

Input data must be provided as a data frame. The first J columns are two-level factors representing the multiple-recapture lists. Arguments in_list_label and not_in_list_label indicate the labels that represent inclusion and exclusion from the lists. This function supports two input formats:

  • When tabular=FALSE each row represents a single individual's capture history. The number of rows must match the size of the observed population. Rows indicating no capture in all list simultaneously are illegal.

  • When tabular=TRUE each row represents a unique capture pattern. This format requires an additional numeric column at the right, called "Freq", indicating the count corresponding to such pattern.

Value

An object of class lcm_CR_Basic initialized and ready to use.

Author(s)

Daniel Manrique-Vallier

See Also

lcm_CR_Basic, lcm_CR_Basic_generator

Examples

require('LCMCR')
data(kosovo_aggregate)
sampler <- lcmCR(captures = kosovo_aggregate, tabular = FALSE, in_list_label = '1',
  not_in_list_label = '0', K = 10, a_alpha = 0.25, b_alpha = 0.25,
  seed = 'auto', buffer_size = 10000, thinning = 100)
sampler
N <- lcmCR_PostSampl(sampler, burnin = 10000, samples = 1000, thinning = 100, output = FALSE)
quantile(N, c(0.025, 0.5, 0.975))

LCMCR documentation built on May 29, 2024, 3:30 a.m.