View source: R/gjamPriorTemplate.R
gjamPriorTemplate | R Documentation |
Constructs coefficient matrices for low and high limits on the uniform prior distribution for beta
.
gjamPriorTemplate(formula, xdata, ydata, lo = NULL, hi = NULL)
formula |
object of class |
xdata |
|
ydata |
|
lo |
|
hi |
|
The prior distribution for a coefficient beta[q,s]
for predictor q
and response s
, is dunif(lo[q,s], hi[q,s])
. gjamPriorTemplate
generates these matrices. The default values are (-Inf, Inf
), i.e., all values in lo
equal to -Inf
and hi
equal to Inf
. These templates can be modified by changing specific values in lo
and/or hi
.
Alternatively, desired lower limits can be passed as the list lo
, assigned to names in xdata
(same limit for all species in ydata
), in ydata
(same limit for all predictors in xdata
), or both, separating names in xdata
and ydata
by "_"
. The same convention is used for upper limits in hi
.
These matrices are supplied in as list betaPrior
, which is included in modelList
passed to gjam
. See examples and browseVignettes('gjam')
.
Note that the informative prior slows computation.
A list
containing two matrices. lo
is a Q x S matrix
of lower coefficient limits. hi
is a Q x S matrix
of upper coefficient limits. Unless specied in lo
, all values in lo = -Inf
. Likewise, unless specied in hi
, all values in hiBeta = -Inf
.
James S Clark, jimclark@duke.edu
Clark, J.S., D. Nemergut, B. Seyednasrollah, P. Turner, and S. Zhang. 2017. Generalized joint attribute modeling for biodiversity analysis: Median-zero, multivariate, multifarious data. Ecological Monographs 87, 34-56.
gjam
## Not run: library(repmis) source_data("https://github.com/jimclarkatduke/gjam/blob/master/forestTraits.RData?raw=True") xdata <- forestTraits$xdata plotByTree <- gjamReZero(forestTraits$treesDeZero) # re-zero traitTypes <- forestTraits$traitTypes specByTrait <- forestTraits$specByTrait tmp <- gjamSpec2Trait(pbys = plotByTree, sbyt = specByTrait, tTypes = traitTypes) tTypes <- tmp$traitTypes traity <- tmp$plotByCWM censor <- tmp$censor formula <- as.formula(~ temp + deficit) lo <- list(temp_gmPerSeed = 0, temp_dioecious = 0 ) # positive effect on seed size, dioecy b <- gjamPriorTemplate(formula, xdata, ydata = traity, lo = lo) ml <- list(ng=3000, burnin=1000, typeNames = tTypes, censor = censor, betaPrior = b) out <- gjam(formula, xdata, ydata = traity, modelList = ml) S <- ncol(traity) sc <- rep('black',S) sc[colnames(traity) pl <- list(specColor = sc) gjamPlot(output = out, plotPars = pl) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.