Compute dose-response functions from a fitted rjMCMC model.

compile_rjMCMC(
  rj.object,
  phase = 1,
  by.model = FALSE,
  model.rank = 1,
  covariate = NULL,
  covariate.values = NULL,
  species = NULL,
  credible.intervals = c(95, 50, 5),
  npts = 20
)

Arguments

rj.object

Input rjMCMC object of class rjtrace, as returned by trace_rjMCMC.

phase

Dose-response functional form: monophasic (1) or biphasic (2).

by.model

Logical. If TRUE, the function subsets posterior parameter estimates to produce separate dose-response curves for each candidate model.

model.rank

Rank of the model to generate curves for when by.model = TRUE.

covariate

Covariate name. This argument can be used to generate dose-response curves for specific contextual covariates, conditioned on the species (group) given by species.

covariate.values

A vector of values for which dose-response curves are required. Only valid for continuous covariates.

species

Species name.

credible.intervals

Credible intervals. Must be a integer vector in (0, 100]. Defaults to 5-95% in 5% increments.

npts

Number of quadrature points to use to integrate out the random effects when computing dose-response curves for biphasic models. Defaults to 20.

Value

A list object of class dose_response.

See also

Author

Phil J. Bouchet

Examples

if (FALSE) { library(espresso) # Import the example data, excluding species with sample sizes < 5 # and considering the sonar covariate mydat <- read_data(file = NULL, min.N = 5, covariates = "sonar") summary(mydat) # Configure the sampler mydat.config <- configure_rjMCMC(dat = mydat, model.select = TRUE, covariate.select = FALSE, function.select = FALSE, n.rep = 100) summary(mydat.config) # Run the reversible jump MCMC rj <- run_rjMCMC(dat = mydat.config, n.chains = 2, n.burn = 100, n.iter = 100, do.update = FALSE) # Burn and thin rj.trace <- trace_rjMCMC(rj.dat = rj) # Get dose-response functions doseR <- compile_rjMCMC(rj.trace) }