Last data update: 2014.03.03

R: Bayesian Nonparametric Latent Class Capture-Recapture
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 particular capture pattern. This format requires an additional numeric column at the right indicating the count corresponding to such pattern.

Value

An object of class lcm_CR_Basic initialized, after running burnin iterations.

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)
quantile(N, c(0.025, 0.5, 0.975))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LCMCR)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LCMCR/lcmCR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lcmCR
> ### Title: Bayesian Nonparametric Latent Class Capture-Recapture
> ### Aliases: lcmCR
> ### Keywords: capture-recapture
> 
> ### ** 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)
WARMING UP...
> sampler
	Initialized = TRUE 
	Current iteration = 0 
Tracer:
	Activated = FALSE 
	Capacity = 10000 samples.
	Used  = 0 (0%)
	Thining = 100 
	Currently Tracing:  
> N <- lcmCR_PostSampl(sampler, burnin = 10000, samples = 1000, thinning = 100)
> quantile(N, c(0.025, 0.5, 0.975))
     2.5%       50%     97.5% 
 9214.925 10388.500 13074.575 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>