run.detectionoccupancy: Fit detection occupancy models using runjags.

Description Usage Arguments Value Functions

View source: R/run_detectionoccupancy.R

Description

Fit detection occupancy models using runjags.

Usage

 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, ...)

Arguments

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 runjags::run.jags()

Value

A runjags object with some modifications:

Functions


sustainablefarms/linking-data documentation built on Oct. 28, 2020, 2:41 a.m.