llcBinREY: Log-Predictive Densities for Lek Count Data Under Different...

Description Usage Format Details Source References See Also Examples

Description

These datasets contain the Log-Predictive Densities (LPD) for each lek under various registered count models, calculated by cross-validation.

Usage

1
2
3
4
5
data("llcBin")
data("llcBinREY")
data("llcBetaBinREY")
data("llcBinPerYear")
data("llcBinREYObs2")

Format

Each dataset is a matrix of class LLCountsSim, returned by the function LLCount of this package, with 330 rows (the 330 leks) and 4000 columns (the 4000 MCMC iterations), containing the LPD calculated for each lek and each MCMC iteration.

Details

Each dataset describes the predictive ability of a tested model, as returned by the function LLCount designed to estimate LPD with objects returned by the function kfoldCVModelCount (which performs K-fold cross-validation). We show in the examples how these datasets were obtained. The models corresponding to these datasets are the following:

llcBinPerYear contains the LPDs for model modelCountDetectBin (see ?modelCountDetectBin), using every single year as a period.

llcBin contains the LPDs for model modelCountDetectBin (see ?modelCountDetectBin), using as periods the two-years periods (2010-2011, 2012-2013, etc.)

llcBinREY contains the LPDs for model modelCountDetectBinREY (see ?modelCountDetectBinREY), using as periods the two-years periods.

llcBetaBinREY contains the LPDs for model modelCountDetectBetaBinREY (see ?modelCountDetectBetaBinREY), using as periods the two-years periods.

To test the predictive ability of a model, this approach consists in splitting the original lek counts dataset lekcounts in G subsets of leks. In the dataset used by Calenge et al. (in prep.), we used 10 groups of 33 leks. Thus, for each subset i, we can build a calibration dataset with all subsets except subset i and fit the model by MCMC with this calibration dataset. The function kfoldCVModelCount performs this operation. We can then predict the count data of each lek using a model fitted without this lek, and calculate the log-probability density of all counts on each lek, for each MCMC vector of parameters simulated the model (avoiding the circularity consisting in using a model fit with a dataset to predict the same dataset). The function LLCount performs this operation. Finally, the function elpdLeks calculates the expected log-probability for each lek.

However, both the functions kfoldCVModelCount and LLCount take a very long time (several hours) so that we included these datasets to allow the readers of Calenge et al. (in prep.) to work directly with the results.

Source

The original Dataset has been kindly provided by the Observatoire des Galliformes de Montagne:

Observatoire des Galliformes de Montagne. 90 impasse des daudes 74320 Sevrier, France.

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

See the vignette vignette("caperpyogm") for a more detailed description of the k-fold validation process. See also kfoldCVModelCount.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## We demonstrate how we calculated llcBinREY, but the process is the
## same for other datasets

## 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 define 10 groups of 33 leks
set.seed(980)
ooo <- sample(c(rep(1:10,each=33)))

## Performs K-fold validation. WARNING!! THIS CALCULATION TAKES
## SEVERAL HOURS!!!
## Not run: 
listCoefsCVBinREY <- kfoldCVModelCount(ooo, dataList, "modelCountDetectBinREY")

## End(Not run)

## To save time for the user, we have stored the result of this
## command in the dataset listCoefsCVBinREY (for the model
## modelCountDetectBinREY only. We could not include the results of
## cross-validation for other models due to the large object size, but
## we can send them on request).
listCoefsCVBinREY

## Finally, we can use LLCount to calculate the LPD of each lek counts
## for each MCMC iteration, under a model that was not fit using these
## counts.
## WARNING!!! THIS CALCULATION ALSO TAKES MORE THAN ONE HOUR!!!
## Not run: 
llcBinREY <- LLCount(dataList, listCVCoefBinREY, oo)

## End(Not run)

## And the result is:
llcBinREY

## Expected LPD can be calculated with:
elpdLeks(llcBinREY)

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