MCEMfit_CR {refitME} | R Documentation |
Function for fitting VGAM
capture-recapture (CR) model using the MCEM algorithm
Description
Function for fitting VGAM
capture-recapture (CR) model using the MCEM algorithm where covariates have measurement error.
Usage
MCEMfit_CR(mod, sigma.sq.u, B = 50, epsilon = 1e-05, silent = FALSE)
Arguments
mod |
: a |
sigma.sq.u |
: measurement error (ME) variance. A scalar if there is only one error-contaminated predictor variable, otherwise this must be stored as a vector (of ME variances) or a matrix if the ME covariance matrix is known. |
B |
: the number of Monte Carlo replication values (default is set to 50). |
epsilon |
: a set convergence threshold (default is set to 0.00001). |
silent |
: if |
Value
MCEMfit_CR
returns model coefficient and population size estimates with standard errors and the effective sample size.
Warning
This function is still under development. Currently the function can only fit the CR model used in the manuscript. IT DOES NOT SUPPORT ALL VGAM
families.
Author(s)
Jakub Stoklosa, Wen-Han Hwang and David I. Warton.
Source
See https://github.com/JakubStats/refitME for an RMarkdown vignette with examples.
References
Stoklosa, J., Hwang, W-H., and Warton, D.I. refitME: Measurement Error Modelling using Monte Carlo Expectation Maximization in R.
See Also
Examples
# A VGAM example using the Prinia flaviventris capture-recapture data.
library(refitME)
library(VGAM)
data(Priniadata)
tau <- 17 # No. of capture occasions.
w1 <- Priniadata$w1 # Bird wing length predictor.
CR_naiv <- vglm(cbind(cap, noncap) ~ w1,
VGAM::posbinomial(omit.constant = TRUE, parallel = TRUE ~ w1),
data = Priniadata, trace = FALSE)
sigma.sq.u <- 0.37 # ME variance.
CR_MCEM <- refitME(CR_naiv, sigma.sq.u)
detach(package:VGAM)