# \donttest{
# Ex. 1: Calculating necessary effort for detection with site-level
# covariates
# Load data
data(goby_data)
# Fit a model including 'Filter_time' and 'Salinity' site-level covariates
fit_cov <- joint_model(data = goby_data, cov = c('Filter_time','Salinity'),
family = "poisson", p10_priors = c(1,20), q = FALSE,
multicore = FALSE)
# Plot at the mean covariate values (covariates are standardized, so mean=0)
detection_plot(fit_cov$model, mu_min = 0.1, mu_max = 1,
cov_val = c(0,0), pcr_n = 3)
# Calculate mu_critical at salinity 0.5 z-scores greater than the mean
detection_plot(fit_cov$model, mu_min = 0.1, mu_max = 1, cov_val = c(0,0.5),
pcr_n = 3)
# Ex. 2: Calculating necessary effort for detection with multiple
# traditional gear types
# Load data
data(green_crab_data)
# Fit a model with no site-level covariates
fit_q <- joint_model(data = green_crab_data, cov = NULL, family = "negbin",
p10_priors = c(1,20), q = TRUE,
multicore = FALSE)
# Calculate
detection_plot(fit_q$model, mu_min = 0.1, mu_max = 1,
cov_val = NULL, pcr_n = 3)
# Change probability of detecting presence to 0.95
detection_plot(fit_q$model, mu_min = 0.1, mu_max = 1, cov_val = NULL,
probability = 0.95, pcr_n = 3)
# }
Run the code above in your browser using DataLab