MNM_control | R Documentation |
This function generates Nimble code for fitting various Multi-Species N-Mixture (MNM) models. These models can include standard MNM, hurdle components, autoregressive (AR) components, or both hurdle and AR components.
MNM_control(
model = "MNM",
prior_detection_probability = "dnorm(0, 0.001)",
prior_precision = "dwish(Omega[1:S,1:S], df)",
prior_mean = "dnorm(0,0.001)",
prior_mean_AR = "dnorm(0,0.001)",
prior_sd_AR = "dexp(1)",
prior_hurdle = "dbeta(1,1)",
Xp = NULL,
Xn = NULL
)
model |
Character. Specifies the type of MNM model to generate. Options are:
|
prior_detection_probability |
Character. Prior distribution for the detection probability intercept ( |
prior_precision |
Character. Prior distribution for the precision matrix for the species-level random effect. Default is |
prior_mean |
Character. Prior distribution for the mean of the species-level random effect ( |
prior_mean_AR |
Character. Prior distribution for the mean of the autoregressive random effect ( |
prior_sd_AR |
Character. Prior distribution for the standard deviation of the autoregressive random effect ( |
prior_hurdle |
Character. Prior distribution for |
Xp |
Array. Covariates influencing detection probability. Dimensions depend on the model:
|
Xn |
Array. Covariates influencing abundance. Dimensions depend on the model:
|
The generated Nimble code can be used to fit Bayesian hierarchical MNM models. Users can specify prior distributions for key model parameters and provide covariate arrays that influence detection probability and abundance. The function validates prior specifications and adapts model code based on the selected model type. Supported models include:
MNM: Standard MNM model
Hurdle: MNM model with a hurdle component
AR: MNM model with an autoregressive component
HurdleAR: MNM model with both hurdle and AR components
This is an internal function, needed for implementing MNM models using the MNM_fit function. While the MNM_fit function allows the user to define prior distributions and linear covariates on detection probability and abundance, if the user wishes to implement more complex models in Nimble (via unsupported prior distributions or non-linear covariate effects), the Nimble model code may be extracted as in examples below, and modified by the user.
Character. Nimble code for the specified MNM model, which can be used for further analysis or fitting.
# Example
# In order to implement scenarios involving nonlinear covariate effects or complex
# interaction terms, the user is invited to extract and modify the MNM Nimble code:
model<-MNM_control(model="MNM")
cat(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.