Description Usage Arguments Value Author(s) See Also Examples

Calculation of animal activity probability density controlling for nested data with random intercepts using Bayesian GLMMs with 'STAN' and `brm`

.
The function can automatically select the statistical distribution that is most appropriate for the dataset (weibull, frechet, gamma, lognormal, inverse gaussian)
using `loo`

and automatically ensures that MCMC chains converge and that a specified minimum effective sample size from the posterior distribution
is achieved. An APD activity curve plot is provided.

Package: AnimalAPD Version: 1.0.0 Date: 2020-11-08

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 | ```
APDRE(
focal,
contingent,
RE1,
RE2 = NULL,
weibullGLMM = TRUE,
frechetGLMM = TRUE,
gammaGLMM = TRUE,
lognormalGLMM = FALSE,
invgaussianGLMM = TRUE,
cores = 1,
iter = 5000,
burnin = iter/2,
center = "pi",
Reloo = TRUE,
adapt_delta = 0.95,
adjust = 1,
minESS = 1000,
col = "deeppink3",
histcol = "deeppink",
linecol = "black",
xlimCV = NULL,
min = TRUE,
max = TRUE,
points = TRUE,
mean = TRUE,
HDI = TRUE,
rawmean = FALSE,
...
)
``` |

`focal` |
Vector of observations in radians of one species/group/individual/etc. for which predictions on another will be made |

`contingent` |
Vector of observations in radians or output from generalized circular mixture model of activity curves from |

`RE1` |
Vector identifying a random intercept for observations of the focal to control for hierarchical data (e.g. camera trap IDs) |

`RE2` |
Optional vector identifying levels of a second random effect, for data with additional hierarchical levels (e.g. study sites, sampling periods, data collection seasons); default is NULL |

`weibullGLMM` |
Specifies whether to run a weibull GLMM, using the brms package; default is TRUE for all and results from the best-fitting model are returned |

`frechetGLMM` |
Specifies whether to run a frechet GLMM, using the brms package; default is TRUE for all and results from the best-fitting model are returned |

`gammaGLMM` |
Specifies whether to run a Gamma GLMM, using the brms package; default is TRUE for all and results from the best-fitting model are returned |

`lognormalGLMM` |
Specifies whether to run a lognormal GLMM, using the brms package; default is TRUE for all and results from the best-fitting model are returned |

`invgaussianGLMM` |
Specifies whether to run a inverse.gaussian GLMM, using the brms package; default is TRUE for all and results from the best-fitting model are returned |

`cores` |
Number of cores to use when running MCMC chains in parallel; default=1 |

`iter` |
Number of MCMC iteractions per chain; default=5000 |

`burnin` |
Number of MCMC iteractions discarded as burnin; default=iter/2 |

`center` |
Value to use as center of graph; default=pi |

`Reloo` |
Whether to use reloo when running leave-one-out cross-validation of models (loo) |

`adapt_delta` |
Value to use for adapt_delta with brms; default=0.95 |

`adjust` |
Smoothing of predicted line; recommended to use default value for observed values and higher value for estimations from circular models |

`minESS` |
Desired minimum effective sample size; default=1000 |

`col` |
Specifies colour of points for the focal in the graph |

`histcol` |
Specifies colour of the histogram plot of the posterior distribution |

`linecol` |
Specifies colour of HDI line in histogram plot of the posterior distribution |

`xlimCV` |
A vector of two values indicating the x axis limits for the histCV graph |

`min` |
Whether to include minimum APD on the graph; default=TRUE; default=TRUE |

`max` |
Whether to include maximum APD on the graph; default=TRUE; default=TRUE |

`points` |
Whether to include datapoints for observations of the focal on the graph; default=TRUE |

`mean` |
Whether to include the estimated mean APD from the GLMM on the graph; default=TRUE |

`HDI` |
Whether to include the estimated 95% highest density interval of mean APD from the GLMM on the graph; default=TRUE |

`rawmean` |
Whether to include the raw mean, not correcting for random effects, on the graph; default=FALSE |

`...` |
Additional parameters |

Prints graph of activity curve and APD estimates from best-fitting GLMM and prints summary of analysis. Returns object of class `APD`

is returned, containing a list of analysis results and details:

`data`

List of data used in analysis

`output`

Matrix with summary output from selected model

`distribution`

Name of distribution of selected model

`model`

An object of class `brmsfit`

containing output from the selected model, including the posterior samples and other information. See `brm`

`CVposterior`

Numeric vector of posterior samples for the calculated family-specific population coefficient of variation (CV)

`allmodels`

List of objects of class `brmsfit`

containing output from all models from the analysis.

`rawvalues`

Numeric vector of the raw, uncorrected APD values

`rawsummary`

List of summary stats of raw APD values

Liz AD Campbell

1 2 3 4 5 6 | ```
data(wolfexample)
data(boarexample)
APDRE(focal=wolfexample$Radians, contingent=boarexample$Radians,
RE1=wolfexample$SamplingPeriod, weibullGLMM=TRUE, frechetGLMM=FALSE,
gammaGLMM=FALSE, lognormalGLMM=FALSE, invgaussianGLMM=FALSE,
min=TRUE, max=TRUE, points=TRUE, mean=TRUE, HDI=TRUE, rawmean=FALSE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.