dataCount2jags: Functions Required for the Lek Count Model Fit

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

View source: R/dataCount2jags.R

Description

dataCount2jags prepares the lek count dataset for model fit and fitModelCount fits the model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
dataCount2jags(lek, period, nbobs, nbmales, gr, type, natun, year)

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

fitModelCount(dataList,
              registeredModel=c("modelCountDetectBinREY",
                                "modelCountDetectBin",
                                "modelCountDetectBetaBinREY",
                                "modelCountDetectBinREYObs2"),
              parameters, inits, n.chains=4,
              n.iter=500000, thin=500)

Arguments

lek

a vector containing the lek label for each lek count in the dataset. Must be numbered from 1 to L (where L is the total number of leks).

period

a vector containing the period label for each lek count in the dataset. Must be numbered from 1 to P (where P is the total number of periods)

nbobs

a vector containing the number of observers for each lek count in the dataset.

nbmales

a vector containing the number of males counted for each lek count in the dataset.

gr

a vector containing the geographic region label for each lek count in the dataset. Must be numbered from 1 to 5.

type

a vector containing the type label for each lek count in the dataset. Must be numbered from 1 to 3 (1 = known active leks, 2 = known indeterminate leks, 3 = unknown leks).

natun

a vector containing the type label for each lek count in the dataset. Must be numbered from 1 to U (where U is the total number of natural units).

year

a vector containing the period label for each lek count in the dataset. Must be numbered from 1 to Y (where Y is the total number of years)

dataList

object of class "caperpyData" returned by the function dataCount2jags containing the dataset used to fit the model.

registeredModel

character string containing the name of a registered count model (see help("modelCountDetectBin") for a list of registered model names).

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 "caperpyData"

...

additional arguments to be passed from and to other functions.

Value

dataCount2jags returns an object of class "caperpyData"

fitModelCount 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

simulateModelCount to simulate datasets with the model, for residual and prediction analysis.

Examples

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

## We prepare the dataset to fit the model with JAGS
dataList <- dataCount2jags(lekcounts$lek, lekcounts$period,
                           lekcounts$nbobs, lekcounts$nbmales,
                           lekcounts$gr, as.numeric(factor(lekcounts$type)),
                           lekcounts$natun, lekcounts$year)
dataList

## We then fit the model. WARNING!!! THIS COMMAND IS VERY SLOW AND
## CAN TAKE SEVERAL HOURS
## Not run: 
coefModelCountDetectBinREY <- fitModelCount(dataList, "modelCountDetectBinREY")

## End(Not run)

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

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