closedp.custom {Rcapture} | R Documentation |
The closedp.mX
function fits a loglinear model given a design matrix mX
. The closedp.h
function fits Mh or Mth models for which the form of the column for heterogeneity in the design matrix is determined by the user.
closedp.mX(X, dfreq=FALSE, mX, mname="Customized model") closedp.h(X, dfreq=FALSE, m="Mh", h="Poisson", a=2) ## S3 method for class 'closedp.custom': print(x, ...) ## S3 method for class 'closedp.custom': boxplot(x, ...)
X |
The table of the observed capture histories in one of the two accepted formats. In the default format, it has one row per unit captured in the experiment. In this case, the number of columns in the table represents the number of capture occasions in the experiment (noted t). In the alternative format, it contains one row per capture history followed by its frequency. In that case, X has t+1 columns. The first t columns of X , identifying the capture histories, must contain only zeros and ones. The number one indicates a capture. |
dfreq |
This argument specifies the format of the data matrix X . By default, it is set to FALSE, which means that X has one row per unit. If it is set to TRUE, then the matrix X contains frequencies in its last column. |
mX |
The design matrix of the loglinear model. In this matrix, the order of the capture histories is as defined in the histpos.t function. |
mname |
A character string specifying the name of the customized model. |
m |
A character string indicating the model to fit, either "Mh"= Mh model or "Mth"= Mth model |
h |
The character string "Poisson" or a numerical R function specifying the form of the column for heterogeneity in the design matrix. "Poisson" represents the function f(k)=a^k-1, where k is the number of captures. If an R function is given, it is the implemantation of any mathematical function f(k). It has only one argument. |
a |
The value of the exponent's base for a Poisson model. |
x |
An object, produced by the closedp.mX or the closedp.h function, to print or to plot. |
... |
Further arguments passed to or from other methods. |
An intercept is added to the model. Therefore, the mX matrix must not contain a column of ones.
The abundance estimation is calculated as the number of captured units plus the exponential of the intercept. Therefore, these functions are not suited for models with a behavioral effect.
In closedp.h
, the argument h
cannot take the value "Chao" or "Darroch". These models are already fitted by the closedp
function.
The boxplot.closedp.custom
function produces a boxplot of the Pearson residuals of the customized model.
n |
The number of captured units |
results |
A table containing the estimated population size, the standard error of estimation, the deviance, the number of degrees of freedom and the Akaike criteria. |
glm |
The 'glm' object obtained from fitting the model. |
These functions use the glm
function of the stats
package.
Sophie Baillargeon Sophie.Baillargeon@mat.ulaval.ca and
Louis-Paul Rivest Louis-Paul.Rivest@mat.ulaval.ca
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/
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.
data(HIV) mat<-histpos.t(4) mX2<-cbind(mat,mat[,1]*mat[,2]) closedp.mX(HIV,dfreq=TRUE,mX=mX2) data(mvole) period3<-mvole[,11:15] psi <- function(x) { -log(3.5 + x) + log(3.5) } closedp.h(period3, h = psi)