Description Usage Arguments Value Functions
View source: R/run_detectionoccupancy.R
Fit detection occupancy models using runjags.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | run.detectionoccupancy(
Xocc,
yXobs,
species,
ModelSite,
OccFmla = "~ 1",
ObsFmla = "~ 1",
nlv = 2,
initsfunction = defaultinitsfunction,
MCMCparams = list(n.chains = 1, adapt = 2000, burnin = 25000, sample = 1000, thin =
30),
filename = NULL
)
prep.data(Xocc, yXobs, ModelSite, species, nlv, XoccProcess, XobsProcess)
prep_new_data(fit, Xocc, yXobs, ModelSite)
defaultinitsfunction(chain, indata, ...)
|
Xocc |
A dataframe of covariates related to occupancy. One row per ModelSite. Must also include the ModelSiteVars columns to uniquely specify ModelSite. |
yXobs |
A dataframe of species observations (1 or 0) and covariates related to observations. One row per visit. Each column is either a covariate or a species. Must also include the ModelSiteVars columns to uniquely specify ModelSite. |
species |
A list of species names (corresponding to columns of yXobs) to model. |
ModelSite |
A list of column names in y, Xocc and Xobs that uniquely specify the ModelSite. Can be simply a ModelSite index |
OccFmla |
A formula specifying the occupancy model in terms of the covariates in Xocc. |
ObsFmla |
A formula specifying the model for detection in terms of the covariates in Xobs. |
nlv |
The number of latent variables |
MCMCparams |
A named list containing values for n.chains, adapt, burnin, sample and thin (to pass to run.jags). Also include keep.jags.files to specify the directory that JAGS data will be saved. |
filename |
If non-null the runjags object (with some extra information) is saved to filename as an RDS. |
XoccProcess |
An object create by prep.designmatprocess for the occupancy covariates |
XobsProcess |
An object create by prep.designmatprocess for the observation covariates |
chain |
Integer. Index of the chain. |
indata |
A list of data that is typically passed to |
A runjags object with some modifications:
the data slot is a in list.format, converted using as_list_format()
elements in the data slot have dimension names given by the input data frames
the slot XoccProcess is the process used to prepare the occupancy covariates (scaling and centering).
It can be applied using apply.designmatprocess()
the slot XobsProcess is the process used to prepare the detection covariates (scaling and centering).
It can be applied using apply.designmatprocess()
ModelSite slot is the list with values for each visit (row in detection covariates) giving the row of the ModelSite in the occupancy covariates.
species slot is the list of species names.
prep.data
: Given the input data parameters of run.detectionoccupancy prepare the data list for JAGS
prep_new_data
: A short function that applies the prep.data function to new data, given an object created by run.detectionoccupancy
Xocc, yXobs, ModelSite must follow some rules as for run.detectionoccupancy, except yXobs may omit the species detections
defaultinitsfunction
: Specifies the initial conditions for the MCMC chains.
This functions is called by run.detectionoccupancy()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.