simulateDataList: Simulate an object of class 'caperpyData' based on a Fitted...

Description Usage Arguments Details Value Author(s) References Examples

Description

The function simulateDataList simulate a data list of class caperpyData using the model modelCountDetectBinREY used in the paper. This dataset can be used to test the effect of unaccounted variation and/or double counts in the detection process.

The functions simulateN and simulateDataList2 also simulate the model, but decompose the simulation of the state process (simulateN) and the simulation of the detection process (simulateDataList2).

Usage

1
2
3
4
5
simulateDataList(coefs, dataList, betaBinDelta = NULL, doubleCountsp = NULL)

simulateN(coefs, dataList)

simulateDataList2(coefs, dataList, simn, betaBinDelta = NULL, doubleCountsp = NULL)

Arguments

coefs

An object of class mcmc.list returned by the function fitModelCount

dataList

An object of class caperpyData returned by the function dataCount2jags.

betaBinDelta

numeric value of the parameter delta2 controlling the amount of extra-binomial variation added to the dataset.

doubleCountsp

numeric value indicating the probability that a detected male is counted twice.

simn

numeric vector containing the values of the number of males simulated on the leks by the function simulateN.

Details

This function can be used to simulate a dataset from the model used in the paper. The parameters used to simulate the model are the median of the posterior distribution. This function can be used to generate extra-binomial variation to the data, or to simulate double counts in the data. This function has been used in the vignette to assess the sensitivity of our model to unaccounted variation in the detection probability and to double counts.

The functions simulateN and simulateDataList2 also simulate the model, but decompose the whole process: simulateN simulates the true numbers of males on the leks and simulateDataList2 simulates the detected number of males, given the true numbers passed as arguments (see the vignette for an example of use).

Value

simulateN return a vector of length n, where n is the number of lek/periods in dataList.

simulateDataList and simulateDataList2 return an object of class "caperpySim".

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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
## Note that the result is stored as a dataset in the package
## Not run: 
coefModelCountDetectBinREY <- fitModelCount(dataList, "modelCountDetectBinREY")

## End(Not run)

## Example of use
dl <- simulateDataList(coefModelCountDetectBinREY, dataList,
                       betaBinDelta = 0.05, doubleCountsp = 0.4)


## Which is equivalent to:
ne <- simulateN(coefModelCountDetectBinREY, dataList)
dl2 <- simulateDataList2(coefModelCountDetectBinREY, dataList, ne,
                        betaBinDelta = 0.05, doubleCountsp = 0.4)

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