Last data update: 2014.03.03

R: Partition of partial capture histories according to...
partition.chR Documentation

Partition of partial capture histories according to equivalence classes of numerical quantification corresponding to supplied intervals

Description

All the possible partial capture histories observable during a capture-recapture experiment with t sampling occasions can be partitioned according to numerical values corresponding to some meaningful covariate (quantification of binary sequences corresponding to partial capture histories). Each subset of the partition corresponds to all partial capture histories which returns numerical values of the quantification within one of the intervals represented by two consecutive values in the optional argument vector breaks.

Usage

partition.ch(quantify.ch.fun, t, breaks, include.lowest = T, 
   type = c("list", "index"), ...)

Arguments

quantify.ch.fun

a function which returns a numerical value for each possible partial capture history

t

an integer. t is number of trapping occasions

breaks

a vector of numerical values which are used as bounds for the interval of numerical values corresponding to partial capture histories that belongs to the same partition

include.lowest

a logical, indicating if an x[i] equal to the lowest (or highest, when right = FALSE) breaks value should be included

type

a character string. It can be either "list" or "index". See examples.

...

additional arguments to be passed to quantify.ch.fun

Details

It is useful in conjunction with LBRecap.custom.part. See examples.

Value

If the argument type="list" a list is returned. If type="index" a numerical index corresponding to the numeric integer equivalent of the consecutive interval according to the convention used in objects of class factor

Author(s)

Danilo Alunni Fegatelli and Luca Tardella

See Also

LBRecap.custom.part, BBRecap.custom.part

Examples


data(mouse)
head(mouse)
t=ncol(mouse)

Mc1.partition=partition.ch(quantify.ch.fun=quant.binary,t=t,breaks=c(0,0.5,1))
Mc1.partition

mod.Mc1.cust=BBRecap.custom.part(mouse,partition=Mc1.partition)
mod.Mc1.cust

mod.Mc1.easy=BBRecap(mouse,mod="Mc",markov.ord=1,output="complete")

mod.Mc1.easy$N.hat.RMSE
mod.Mc1.easy$HPD.N
mod.Mc1.easy$log.marginal.likelihood

# the two functions give the same results!


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(BBRecapture)
Loading required package: HI
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: lme4
Loading required package: Matrix
Loading required package: secr
This is secr 2.10.3. For overview type ?secr
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BBRecapture/partition.ch.Rd_%03d_medium.png", width=480, height=480)
> ### Name: partition.ch
> ### Title: Partition of partial capture histories according to equivalence
> ###   classes of numerical quantification corresponding to supplied
> ###   intervals
> ### Aliases: partition.ch
> 
> ### ** Examples
> 
> 
> data(mouse)
> head(mouse)
     V1 V2 V3 V4 V5
[1,]  1  1  0  1  1
[2,]  0  1  1  1  1
[3,]  1  1  1  1  0
[4,]  1  1  1  1  1
[5,]  1  1  1  1  1
[6,]  1  1  1  1  1
> t=ncol(mouse)
> 
> Mc1.partition=partition.ch(quantify.ch.fun=quant.binary,t=t,breaks=c(0,0.5,1))
> Mc1.partition
$`[0,0.5]`
 empty      0     00     10    000    100    010    110   0000   1000   0100 
    ""    "0"   "00"   "10"  "000"  "100"  "010"  "110" "0000" "1000" "0100" 
  1100   0010   1010   0110   1110 
"1100" "0010" "1010" "0110" "1110" 

$`(0.5,1]`
     1     01     11    001    101    011    111   0001   1001   0101   1101 
   "1"   "01"   "11"  "001"  "101"  "011"  "111" "0001" "1001" "0101" "1101" 
  0011   1011   0111   1111 
"0011" "1011" "0111" "1111" 

> 
> mod.Mc1.cust=BBRecap.custom.part(mouse,partition=Mc1.partition)
> mod.Mc1.cust
$Prior.N
[1] "Rissanen"

$N.hat.RMSE
[1] 106

$HPD.N.
[1] 104 110

$log.marginal.likelihood
[1] -339.8946

> 
> mod.Mc1.easy=BBRecap(mouse,mod="Mc",markov.ord=1,output="complete")
> 
> mod.Mc1.easy$N.hat.RMSE
[1] 106
> mod.Mc1.easy$HPD.N
[1] 104 110
> mod.Mc1.easy$log.marginal.likelihood
[1] -339.8946
> 
> # the two functions give the same results!
> 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>