For a latent class model for capture-recapture data, it provides design matrices for the loglinear parametrization used to formulate the conditional distribution of the capture configurations given the latent class. It is possible to include the effect of covariates and bivariate interactions.
design_matrix_loglin(J, H =1, main = c("LC","same","Rasch"), X =NULL, free_cov = c("no","class","resp","both"), biv =NULL, free_biv = c("no","class","int","both"))
Arguments
J: number of capture occasions
H: number of latent classes
main: "LC" for the latent class model in which there is a separate main effect for each capture occasion and latent class; "same" for the constrained model in which the main effect is the same across capture occasions but different across latent classes; "Rasch" for the constrained model in which each main effect is expressed in an additive form with a parameter related to the latent class and another parameter related to the capture occasion
X: array of covariates (n. strata x n. covariates x n. responses)
free_cov: "no" for constant effect of the covariates across capture occasions and latent classes; "class" for effect of covariates varying only with the latent class; "resp" for effect of covariates varying only with the capture occasion; "both" for effect of covariates varying with the capture occasion and the latent class
biv: matrix with two columns containing the list of bivariate interactions
free_biv: "no" for constant bivariate interation effect with respect to the occasion and the latent class; "class" for free interaction with respect to the latent class; "int" for free effect only with respect to the interation; "both" for free effect with respect to interation and latent class
Returns
M: design matrices
par_list: list of parameter names
Main: list of capture configurations
References
Forcina, A. and Bartolucci, F. (2021). Estimating the size of a closed population by modeling latent and observed heterogeneity, arXiv:2106.03811.