Define several parameters required to configure the rjMCMC sampler.

configure_rjMCMC(
  dat,
  model.select = TRUE,
  covariate.select = FALSE,
  function.select = TRUE,
  biphasic = FALSE,
  proposal.mh = list(t.ij = 10, mu.i = 5, mu = 2, phi = 5, sigma = 5, nu = 5, tau = 5,
    alpha = 2, mu.ij = 5, psi = 1, omega = 2, psi.i = 2, k.ij = 0.5),
  proposal.rj = list(rj = 5, dd = 10, cov = 3),
  priors = list(covariates = c(0, 30), alpha = c(110, 160), sigma = c(1, 45), phi =
    c(1, 45), omega = c(0.5, 5), tau = c(1, 45), psi = c(0, 1)),
  p.split = 0.5,
  p.merge = 0.5,
  bootstrap = TRUE,
  n.rep = 100
)

Arguments

dat

Input BRS data. Must be an object of class brsdata.

model.select

Logical. If TRUE, between-model jumps will be allowed in the rjMCMC sampler. This argument can be set to FALSE to impose a species grouping and constrain parameter estimation accordingly.

covariate.select

Logical. Set to TRUE to allow contextual covariates to drop out of the model.

function.select

Logical. Set to TRUE to evaluate support for dose-response functional forms (monophasic vs. biphasic).

biphasic

Logical. Specifies which functional form to impose. Monophasic dose-response curves are returned when biphasic = FALSE. This argument is ignored when function.select = TRUE.

proposal.mh

Named list specifying the standard deviations of the proposal distributions used in the Metropolis-Hastings sampler.

proposal.rj

Named list specifying the standard deviations of the proposal distributions used in the reversible jump sampler. Must contain two elements: mu for response thresholds, and cov for covariates.

priors

Named list giving the means and standard deviations for Normal priors and the lower and upper bounds for Uniform priors. Relevant parameters for the monophasic model are as follows: sigma (Uniform), phi (Uniform). Parameters for the biphasic model include: alpha (Uniform), omega (Uniform), tau (Uniform), psi (Normal). Normal priors are placed on contextual covariates.

p.split

Probability of choosing to split a group of species when initiating a split-merge move. This parameter is constrained to be 1 when all species are in a single group. p.split and p.merge must sum to 1.

p.merge

Probability of choosing to merge two groups of species when initiating a split-merge move. This parameter is constrained to be 1 when all species are in their own groups. p.split and p.merge must sum to 1.

bootstrap

Logical, defaults to TRUE. Whether to perform bootstrap clustering. As this step can be time-consuming, setting this argument to FALSE increases efficiency when re-configuring the sampler.

n.rep

Number of replicate bootstrap datasets used for clustering (see Details).

Value

A list object of class rjconfig identical to the input brsdata object, with an additional config element composed of:

varEmpirical estimates of φ and σ
propStandard deviations of MCMC proposal distributions
clustOutputs from the cluster analysis
bootSpecies group assignments for each bootstrap dataset
mlistUnique species group assignments
priorMean and standard deviation of the Normal priors placed on covariates
...Other elements pulled from the brsdata object

Details

The function performs three actions:

Variance

Returns empirical estimates of between-whale (φ) and within-whale between-exposure (σ) variation, which are needed to generate starting values for the MCMC chains

Proposals

Defines the means and standard deviations of relevant proposal distributions and priors

Clustering

Performs a cluster analysis using n.rep bootstrap replicates of the input data, in order to initialise between-model jumps. The analysis is run using Mclust (Scrucca et al. 2016) on both (1) species means and (2) raw observations. These respectively provide estimates of the probability distributions of (1) unique groupings, and (2) numbers of groups, where the latter ranges from n = 1 when all species belong to the same group, to n = n.species when each species is treated individually.

References

Scrucca L, Fop M, Murphy TB, Raftery AE (2016). “mclust 5: Clustering, classification and density estimation using Gaussian finite mixture models.” The R Journal, 8(1), 289--317. https://doi.org/10.32614/RJ-2016-021.

See also

Author

Phil J. Bouchet

Examples

if (FALSE) { library(espresso) # Import the example data, excluding species # with less than 5 observations mydat <- read_data(file = NULL, min.N = 5) summary(mydat) # Configure the rjMCMC sampler mydat.config <- configure_rjMCMC(dat = mydat, model.select = TRUE, covariate.select = FALSE, function.select = FALSE, n.rep = 100) summary(mydat.config) }