pecan.ma.Rd
Runs hierarchical meta-analysis of plant trait data
pecan.ma(
trait.data,
prior.distns,
taupriors,
j.iter,
outdir,
random = FALSE,
overdispersed = TRUE,
logfile = file.path(outdir, "meta-analysis.log)"),
verbose = TRUE
)
list of data.frame
s, one per trait for which
data is available, generated by call to
PEcAn.DB::query.traits()
, and post-processed by jagify()
.
data.frame
of prior distributions generated
by call to PEcAn.DB::query.priors()
priors on variance parameters, can be scaled as needed with data mean
number of MCMC samples
output directory
use random effects, FALSE
by default
TRUE
by default, if set to FALSE
, data mean will be used as starting point for MCMC chains (use with caution)
Path to file for sinking meta analysis output. If
NULL
, only print output to console.
Logical. If TRUE
(default), print progress messages.
data frame generated by jagify function with indexed values for greenhouse, treatment, and site (ghs, trt, site) as well as Y, SE, and n for each observation or summary statistic.
four chains with 5000 total samples from posterior
pecan.ma
runs a hierarchical Bayesian meta-analytical model.
This model combines prior information with data from studies on the particular species or group of interest.
Data that is incorporated into the meta-analysis include the mean (Y
), sample size (n
),
and precision (obs.prec
).
Where a set of data includes more than one level of treatment, comes from more than one site,
or comes from both field and greenhouse studies, these variables are included as random (treatment
, site
)
or fixed (greenhouse
) effects.
The pecan.ma
function writes a model for each specific data set and prior using the write.ma.model()
function to modify the ma.model.template.bug
generic model.
if (FALSE) { # \dontrun{
# Setup
con <- PEcAn.DB::db.open(...)
pft <- "temperate.Early_Hardwood"
pft_id <- PEcAn.DB::db.query("SELECT id FROM pfts WHERE name = $1", con,
values = list(pft))[[1]]
traits <- c("SLA", "Vcmax")
trait_string <- paste(shQuote(traits), collapse = ",")
# Load traits and priors from BETY
species <- PEcAn.DB::query.pft_species(pft, con = con)
trait.data <- PEcAn.DB::query.traits(species[["id"]], c("SLA", "Vcmax"), con = con)
prior.distns <- PEcAn.DB::query.priors(pft_id, trait_string, con = con)
# Pre-process data
jagged.data <- lapply(trait.data, PEcAn.MA::jagify)
taupriors <- list(tauA = 0.01,
tauB = c(SLA = 1000, Vcmax = 1000))
result <- pecan.ma(jagged.data, prior.distns, taupriors,
j.iter = 5000, outdir = tempdir())
} # }