Learn R Programming

Rcapture (version 1.2-1)

closedpCI: Customization of a Loglinear Model and profile Likelihood Confidence Interval for Abundance Estimation in Closed Population Capture-Recapture Experiments

Description

The closedpCI.t and closedpCI.0 functions fit a loglinear model specified by the user and computes the multinomial profile likelihood confidence interval for the adundance estimation. The model can be given as a design matrix mX or identified trougth arguments m, h and theta. These functions extand closedp.t and closedp.0 as they broaden the range of model one can fit and they computes confidence interval. Unlike the closedp functions, it fits only one model at a time.

Usage

closedpCI.t(X, dfreq=FALSE, m=c("M0","Mt","Mh","Mth"), 
            h=c("Chao","Poisson","Darroch","Gamma"), theta=2, 
            mX=NULL, mname, neg=TRUE, alpha=0.05)

closedpCI.0(X, dfreq=FALSE, dtype=c("hist","nbcap"), t, t0=t, 
            m=c("M0","Mh"), h=c("Chao","Poisson","Darroch","Gamma"), 
            theta=2, mX=NULL, mname, neg=TRUE, alpha=0.05)
			
## S3 method for class 'closedpCI':
print(x, \dots)

plotCI(x, ...)
## S3 method for class 'closedpCI':
plotCI(x, main="Profile Likelihood Confidence Interval", \dots)

## S3 method for class 'closedpCI':
boxplot(x, main="Boxplots of Pearson Residuals", \dots)

## S3 method for class 'closedpCI':
plot(x, main="Scatterplot of Pearson Residuals", \dots)

Arguments

X
The matrix of the observed capture histories (see Rcapture-package for a description of the accepted formats).
dfreq
A logical. By default FALSE, which means that X has one row per unit. If TRUE, it indicates that the matrix X contains frequencies in its last column.
dtype
A characters string, either "hist" or "nbcap", to specify the type of data. "hist", the default, means that X contains complete observed capture histories. "nbcap" means that X contains numbers of captures (see
t
Requested only if dtype="nbcap". A numeric specifying the total number of capture occasions in the experiment.
t0
A numeric. Models are fitted considering only the frequencies of units captured 1 to t0 times. By default t0=t.
m
A character string indicating the model to fit. For closedpCI.0 it can be either "M0"=M0 model or "Mh"=Mh model. For closedpCI.t it can also be "Mt"=Mt model or "Mth"=Mth model.
h
A character string ("Chao", "Poisson", "Darroch" or "Gamma") or a numerical R function specifying the form of the column for heterogeneity in the design matrix. "Chao" represents Chao's model, "Poisson" represents the function $f(k)=theta^k-1
theta
The value of the parameter for a Poisson or Gamma model.
mX
The design matrix of the loglinear model. In this matrix, the order of the capture histories is as defined in the histpos.t or histpos.0 function.
mname
A character string specifying the name of the customized model.
neg
If this option is set to TRUE, negative eta parameters in Chao's models are set to zero.
alpha
A confidence interval with confidence level 1-alpha is constructed. The value of alpha must be between 0 and 1; the default is 0.05.
x
An object, produced by the closedpCI.t function, to print.
main
A main title for the plot
...
Further arguments to be passed to methods (see print.default, plot.default or boxplot.default).

Value

  • nThe number of captured units
  • tThe number of capture occasions in the data matrix X
  • resultsA table containing the estimated population size, the standard error of estimation, the deviance, the number of degrees of freedom and the Akaike criteria.
  • glmThe 'glm' object obtained from fitting the model.
  • CIA table containing the abundance estimation and its confidence interval.
  • alpha1-the confidence level of the interval.
  • NCIThe x-coordinates for plot.closedpCI.t
  • loglikCIThe y-coordinates for plot.closedpCI.t
  • t0A copy of the t0 argument given in the function call.

Details

The closedpCI.t function fits models using the frequencies of the observable capture histories (vector of size $2^t-1$), whereas closedp.0 uses the number of units capture i times, for $i=1,\ldots,t$ (vector of size $t$). Thus, closedpCI.0 can be used with data sets larger than those for closedpCI.t. This function does not work for closed population models featuring a behavioral effect, such as Mb and Mbh. The abundance estimation is calculated as the number of captured units plus the exponential of the Poisson regression intercept. However, models with a behavioral effect can by fitted with closedp.t (Mb and Mbh), closedp.Mtb and closedp.bc. An intercept is added to the model. Therefore, the mX matrix must not contain a column of ones. The plotCI.closedpCI function produces a plot of the multinomial profile likelihood for N. The value of N maximizing the profile likelihood and the bounds of the confidence interval are identified. The boxplot.closedpCI function produces a boxplot of the Pearson residuals of the customized model. The plot.closedpCI function traces the scatterplot of the Pearson residuals in terms of $f_i$ (number of units captured i times) for the customized model.

References

Baillargeon, S. and Rivest, L.P. (2007) Rcapture: Loglinear models for capture-recapture in R. Journal of Statistical Software, 19(5), http://www.jstatsoft.org/v19/i05. Rivest, L.P. and Baillargeon, S. (2007) Applications and extensions of Chao's moment estimator for the size of a closed population. Biometrics, 63(4), 999--1006. Cormack, R. M. (1992) Interval estimation for mark-recapture studies of closed populations. Biometrics, 48, 567--576.

See Also

closedp, closedp.Mtb

Examples

Run this code
data(hare)
CI<-closedpCI.t(hare, m = "Mth", h = "Poisson", theta = 2)
CI
plotCI(CI)

data(HIV)
mat<-histpos.t(4)
mX2<-cbind(mat,mat[,1]*mat[,2])
closedpCI.t(HIV,dfreq=TRUE,mX=mX2,mname="Mt interaction 1,2")

data(BBS2001)
CI0<-closedpCI.0(BBS2001,dfreq=TRUE,dtype="nbcap",t=50,t0=20,
                 m="Mh",h="Gamma",theta=3.5)
CI0
plot(CI0)
plotCI(CI0)

### As an alternative to a gamma model, one can fit a negative Poisson model.
### It is appropriate in experiments where very small capture probabilities
### are likely. It can lead to very large estimators of abundance. 
data(mvole)
period3<-mvole[,11:15]
psi <- function(x) { 0.5^x - 1 }
closedpCI.t(period3, m = "Mh", h = psi)

Run the code above in your browser using DataLab