datagrid2jags: Functions Required for the Grid Cell Search Model Fit

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/datagrid2jags.R

Description

datagrid2jags prepares the grid cell search dataset for model fit and fitModelGrid fits the model.

Usage

1
2
3
4
5
6
7
  datagrid2jags(searchData, experiment)

  ## S3 method for class 'caperpyGridData'
print(x, ...)

  fitModelGrid(dataList, registeredModel = c("modelULPresence"),
               parameters, inits, n.chains = 4, n.iter = 5e+05, thin = 500)

Arguments

searchData

A data.frame containing the results of grid cell searches carried out between 2010 and 2019, with the same format as the dataset gridSearch (must contain columns named gr indicating the geographic region where the searched cell is located, presenceArea indicating the proportion of the cell covered by area of presence of the capercaillie, newUL indicating whether an unknown lek was uncovered by the search, previousSearch indicating whether (1) or not (1) there was a possibility that the grid cell has been searched for new leks prior to the random selection in the program, hasPreviousUL indicating whether an unknown lek was already discovered between 2010 and the random selection of the cell, and presenceKL indicating whether a known active or indeterminate lek is present in the cell).

experiment

A data.frame containing the results of the experiment carried out to assess the probability of detection of an unknown lek in a grid cell with the search protocol, with the same format as the dataset DetectionExpe (must contain the 4 variables: observer containing the type of observer that searched the grid cell [experienced/inexperienced], Nquad indicating the number of leks in the grid cell searched by the observer, Nsect indicating how many leks were actually included in the sector defined by the observer, among those present within the cell, and Ndete indicating how many leks were detected by the observers among those both present in the grid cell and included in the search sector).

dataList

object of class "caperpyGridData" returned by the function datagrid2jags containing the dataset used to fit the model.

registeredModel

character string containing the name of a registered count model (today, "modelULPresence" is the only available model, see help("modelULPresence")).

parameters

vector of character string containing name of parameters to monitor during MCMC iterations. Can be left unspecified.

inits

The starting values for the MCMC. Can be left unspecified.

n.chains

The number of MCMC chain to perform.

n.iter

The number of MCMC iterations to monitor.

thin

thinning intervals for monitors.

x

an object of class "caperpyGridData"

...

additional arguments to be passed from and to other functions.

Value

datagrid2jags returns an object of class "caperpyGridData"

fitModelGrid returns an object of class "mcmc.list", returned by rjags.

Author(s)

Clement Calenge clement.calenge@ofb.gouv.fr

References

Calenge C., Menoni E., Milhau B., Foulche K, Chiffard J., Marchandeau S. (in prep.). The participatory monitoring of the capercaillie in the French Pyrenees.

See Also

modelULPresence for a description of the registered models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## We work on the gridSearch dataset...
head(gridSearch)

## ...and on the experiment dataset:
head(DetectionExpe)

## We prepare the dataset to fit the model with JAGS
dataListQ <- datagrid2jags(gridSearch, DetectionExpe)

## We then fit the model. WARNING!!! THIS COMMAND IS VERY SLOW AND
## CAN TAKE SEVERAL HOURS
## Not run: 
coefModelULPresence <- fitModelGrid(dataListQ, "modelULPresence")

## End(Not run)

## To save time for the user, we have stored the result of this
## command in the dataset coefModelULPresence.
str(coefModelULPresence)

ClementCalenge/caperpyogm documentation built on Sept. 14, 2021, 4:14 p.m.