# Load the package
library(extBatchMarking)
# Load the WeatherLoach data from Cowen et al., 2017.
data(WeatherLoach)
# Initial parameter values
theta <- c(0.1, 0.1, 7, -1.5)
# \donttest{
mod1 <- batchMarkUnmarkOptim(
par = theta,
data = WeatherLoach,
Umax = 1800,
nBins = 600,
covariate_phi = NULL,
covariate_p = NULL,
choiceModel = "model4",
popSize = "Horvitz_Thompson",
method = "CG",
control = list(trace = 1))
# Survival probability
mod1$phi
# Capture probability
mod1$p
# Optimized log-likelihood
mod1$ll
# The Aikaike Information Criteria
mod1$AIC
# The initial mean abundance
mod1$lambda
# Recruitment rate into the population
mod1$gam
# The estimated abundance of unmarked animals
mod1$U
# The estimated abundance of marked animals
mod1$M
# The estimated total abundance of marked and unmarked animals
mod1$N
# }
# \donttest{
mod2 <- batchMarkUnmarkOptim(
par = theta,
data = WeatherLoach,
Umax = 1800,
nBins = 600,
choiceModel = "model4",
covariate_phi = NULL,
covariate_p = NULL,
popSize = "Model-Based",
method = "L-BFGS-B",
control = list(trace = 1))
# print(mod2)
# plot(mod2)
# Survival probability
mod2$phi
# Capture probability
mod2$p
# Optimized log-likelihood
mod2$ll
# The Akaike Information Criteria
mod2$AIC
# The initial mean abundance
mod2$lambda
# Recruitment rate into the population
mod2$gam
# The estimated abundance of unmarked animals
mod2$U
# The estimated abundance of marked animals
mod2$M
# The estimated total abundance of marked and unmarked animals
mod2$N
# }
Run the code above in your browser using DataLab