View source: R/compile_rjMCMC.R
compile_rjMCMC | R Documentation |
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 = 95,
npts = 20
)
rj.object |
Input rjMCMC object of class |
phase |
Dose-response functional form: monophasic (1) or biphasic (2). |
by.model |
Logical. If |
model.rank |
Rank of the model to generate curves for when |
covariate |
Covariate name. This argument can be used to generate dose-response curves for specific contextual covariates, conditioned on the species (group) given by |
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 |
npts |
Number of quadrature points to use to integrate out the random effects when computing dose-response curves for biphasic models. Defaults to 20. |
A list object of class dose_response
.
Phil J. Bouchet
run_rjMCMC
plot.dose_response
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.