"Workflow" version of run.meta.analysis.pft #' Run Bayesian meta-analysis for a single PFT (file-based wrapper)
Source:R/run.meta.analysis.R
run.meta.analysis.pft.Rd"Workflow" version of run.meta.analysis.pft #' Run Bayesian meta-analysis for a single PFT (file-based wrapper)
Usage
run.meta.analysis.pft(
pft,
iterations,
random = TRUE,
threshold = 1.2,
dbfiles,
dbcon,
use_ghs = TRUE,
update = FALSE
)Arguments
- pft
(list) PFT list object, as defined in settings. Must include the following:
outdir,name,posteriorid- iterations
(integer) Number of sampler iterations for MCMC analysis
- random
(boolean; default = TRUE) Should random effects be used?
- threshold
Gelman-Rubin convergence diagnostic (MGPRF) default = 1.2 following Bolker 2008 Ecological Models and Data in R
- dbfiles
(character) directory where previous results are found
- dbcon
(DBI connection object) BETY database connection object
- use_ghs
(boolean; default = TRUE) If TRUE, do not exclude greenhouse data
- update
(boolean; default = FALSE) If
TRUE, replace existing posteriors with new ones
Value
The pft list (invisibly), or NA if no trait data are available.
The returned pft list is a named list with the following elements:
name(character) PFT name, e.g.
"temperate.deciduous".outdir(character) Path to directory where output files are stored (trait data, priors, posteriors, MCMC samples).
posteriorid(integer) Row ID of the posterior record in BETYdb's
posteriorstable.constants(named list, optional) Trait values to treat as fixed constants, bypassing the meta-analysis.
The function's primary outputs are communicated through files saved in
pft$outdir.
Details
Upstream contract (reads from pft$outdir):
trait.data.RdataNamed list of data frames produced by
get.trait.data.pft. Loaded intotrait_env$trait.data.prior.distns.RdataData frame of prior distributions produced by
get.trait.data.pft. Loaded intoprior_env$prior.distns.
File-based side effects (saved to pft$outdir):
trait.mcmc.RdataContains
trait.mcmc: a named list ofmcmc.listobjects (one per trait) with posterior MCMC samples from JAGS. Each element has columnsbeta.o(overall mean) and optionallysd.o(overall SD).post.distns.MA.RdataContains
post.distns: a data frame with one row per trait and columnsdistn,parama,paramb,nsummarizing the fitted posterior distribution.post.distns.RdataSymlink to
post.distns.MA.Rdata.jagged.data.RdataContains
jagged.data: a named list of data frames (one per trait) formatted for use in the JAGS meta-analysis model (seejagify).
Downstream contract: The files trait.mcmc.Rdata and
post.distns.Rdata are expected by get.parameter.samples (in
PEcAn.uncertainty), which loads them to generate ensemble and sensitivity
analysis samples.
Note: The core computation is performed by meta_analysis_standalone,
which accepts and returns R objects directly — see its documentation for
the pure-function interface.