Calculates estimated relationships between activity probability density (APD) of the focal and contingent(s) using Bayesian GLMMs with 'STAN'
using brm, with the option to automatically select the statistical distribution that best fits the dataset (weibull,
frechet, gamma, lognormal, inverse gaussian) by loo. The function automatically ensures that MCMC chains reach
convergence and that the specified minimum effective sample size from the posterior distribution is achieved.
Package: AnimalAPD Version: 1.0.0 Date: 2020-11-10
APDREcorr(
focal,
cont1,
cont2 = NULL,
cont3 = NULL,
cont4 = NULL,
RE1,
RE2 = NULL,
weibullGLMM = TRUE,
frechetGLMM = TRUE,
gammaGLMM = TRUE,
lognormalGLMM = FALSE,
invgaussianGLMM = TRUE,
cores = 1,
iter = 5000,
minESS = 1000,
burnin = iter/2,
thin = 1,
adapt_delta = 0.95,
center = "pi",
adjust = 1,
Reloo = TRUE,
plothist = TRUE,
ploteffects = TRUE,
histcol = "cyan4",
effectcol = "cyan4",
linecol = "red"
)Vector of observations in radians of one species/group/individual/etc. for which predictions on another will be made.
Vector of observations in radians, or output from generalized circular mixture model of activity curves from GCMM, of a species/group/individual/etc. from which predictions will be made
Optional vector of observations in radians, or output from generalized circular mixture model of activity curves from GCMM, of additional species/group/individual/etc. from which predictions will be made
Optional vector of observations in radians, or output from generalized circular mixture model of activity curves from GCMM, of additional species/group/individual/etc. from which predictions will be made
Optional vector of observations in radians, or output from generalized circular mixture model of activity curves from GCMM, of additional species/group/individual/etc. from which predictions will be made
Vector identifying a random intercept for observations of the focal to control for hierarchical data (e.g. camera trap IDs)
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
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
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
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
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
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
Number of cores to use when running MCMC chains in parallel; default=1
Number of MCMC iteractions per chain; burnin is iter/2; default=5000
Desired minimum effective sample size; default=1000
Number of MCMC iterations to be discarded as the burn-in; default=iter/2
Thinning rate for saving MCMC draws; default=1
Value to use for adapt_delta with brms; default=0.95; see also brms
Value to use as center of graph; default=pi
Smoothing of predicted line; recommended to use default value for observed values and higher value for estimations from circular models
Whether to plot histograms of samples from the posterior distribution for the correlation parameters; default=TRUE
Whether to plot predicted effects; default=TRUE
Colour for histogram bars
Colour for predicted effect plot 95% HDI
Colour for histogram lines for the 95% HDI and 0
Prints results of best-fitting model and posterior samples and/or predicted effects of parameter estimates if plothist=TRUE
and ploteffects=TRUE, and returns object of class APD with list of analysis results and information.
data List of data used in analysis
model Object of class brmsfit containing results and information for best-fitting model.
distribution Character vector of statistical distribution of best-fitting model
allmodels List of output for all tested models; object of class brmsfit
# NOT RUN {
data(wolfexample)
data(boarexample)
# }
# NOT RUN {
APDREcorr(focal=wolfexample$Radians,cont1=boarexample$Radians,
RE1=wolfexample$SamplingPeriod)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab