Rcapture (version 1.4-4)

openp: Loglinear Models for Open Population Capture-Recapture Experiments


This function computes various demographic parameters using a loglinear model for open populations in capture-recapture experiments.


openp(X, dfreq=FALSE, m=c("up","ep"), neg=TRUE, keep=rep(TRUE,2^I-1))

# S3 method for openp print(x, …)

# S3 method for openp plot(x, main="Scatterplot of Pearson Residuals", …)



The matrix of the observed capture histories (see Rcapture-package for a description of the accepted formats).


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.


This argument is a character string taking the value "up" (up = unconstrained probabilities) or "ep" (ep = equal probabilities). If m is set to "up" (the default), no constraint is set on the loglinear parameters. Therefore some loglinear and demographic parameters are not estimable. On the other hand, when m takes the value "ep", the capture probabilities are set to a common value; this enables the estimation of all the parameters.


This option is useful to fit the model on a subset of the possible capture histories. keep is a logical vector of length \(2^I-1\) taking the value TRUE for a history kept and FALSE for a history put aside. In this vector, the order of the capture histories is as defined in the histpos.t function. By default, every capture history is kept.


If this option is set to TRUE, relevant negative gamma parameters are set to zero. This insures that the estimated survival probabilities belong to [0, 1] and that the births are positive.


An object, produced by the openp function, to print or to plot.


A main title for the plot

Further arguments to be passed to methods (see print.default and plot.default).



The number of captured units


A table containing the deviance, degrees of freedom and AIC of the fitted model.


A table containing, for the models with an added trap effect, the deviance, degrees of freedom and AIC.


The estimated trap effect parameters and their standard errors. For m="up", the \(I-3\) first rows of trap.param are estimations of the differences \(logit\)(capture probability after a capture)- \(logit\)(capture probability after a miss) for periods 3 to \(I-1\). The last row gives a pooled estimate of these differences calculated under the assumption that they are homogeneous.


The estimated capture probabilities per period and their standard errors.


The estimated survival probabilities between periods and their standard errors.


The estimated population sizes per period and their standard errors.


The estimated number of new arrivals in the population between periods and their standard errors.


The estimated total number of units who ever inhabited the survey area and its standard error.


The 'glm' object obtained from fitting the loglinear model


The loglinear model parameters estimations and their standard errors, calculated by the glm function.


The Ui statistics, useful for the survival probabilities calculation, and their standard errors


The Vi statistics, useful for the population sizes estimation, and their standard errors


The covariance matrix of all the demographic parameters estimates.


The position of the gamma parameters set to zero in the loglinear parameter vector.


The function openp generates statistics to test the presence of a trap effect.

The plot.openp function produces a scatterplot of the Pearson residuals of the model versus the frequencies of capture.

If the data matrix X was obtained through the periodhist function, the dfreq argument must be set to TRUE.

Standard errors are calculated by linearization.


Baillargeon, S. and Rivest, L.P. (2007) Rcapture: Loglinear models for capture-recapture in R. Journal of Statistical Software, 19(5), 10.18637/jss.v019.i05.

Rivest, L.P. and Daigle, G. (2004) Loglinear models for the robust design in mark-recapture experiments. Biometrics, 60, 100--107.

See Also

closedp, periodhist, robustd


Run this code
# duck data set
op.m1 <- openp(duck, dfreq = TRUE)

# To remove the capture history 111111.
keep2 <- apply(histpos.t(6), 1, sum) != 6
op.m2 <- openp(duck, dfreq = TRUE, keep = keep2)

# To remove the capture histories with 5 captures or more
keep3 <- apply(histpos.t(6), 1, sum) < 5
op.m3 <- openp(duck, dfreq = TRUE, keep = keep3)

# mvole data set aggregated per primary period
mvole.op <- periodhist(mvole, vt = rep(5, 6))
openp(mvole.op, dfreq = TRUE)
# }

Run the code above in your browser using DataCamp Workspace