gjamSensitivity: Sensitivity coefficients for gjam

View source: R/gjamHfunctions.R

gjamSensitivityR Documentation

Sensitivity coefficients for gjam

Description

Evaluates sensitivity coefficients for full response matrix or subsets of it. Uses output from gjam. Returns a matrix of samples by predictors.

Usage


  gjamSensitivity(output, group = NULL, nsim = 100, PERSPECIES = TRUE)
  

Arguments

output

object fitted with gjam.

group

character vector of response-variable names from output$inputs$y.

nsim

number of samples from posterior distribution.

PERSPECIES

divide variance by number of species in the group

Details

Sensitivity to predictors of entire reponse matrix or a subset of it, identified by the character string group. The equations for sensitivity are given here:

browseVignettes('gjam')

Value

Returns a nsim by predictor matrix of sensitivities to predictor variables, evaluated by draws from the posterior. Because sensitivities may be compared across groups represented by different numbers of species, PERSPECIES = TRUE returns sensitivity on a per-species basis.

Author(s)

James S Clark, jimclark@duke.edu

References

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.

See Also

gjamSimData simulates data

A more detailed vignette is can be obtained with:

browseVignettes('gjam')

website 'http://sites.nicholas.duke.edu/clarklab/code/'.

Examples

## Not run: 
## combinations of scales
types <- c('DA','DA','OC','OC','OC','OC','CC','CC','CC','CC','CC','CA','CA','PA','PA')         
f    <- gjamSimData(S = length(types), typeNames = types)
ml   <- list(ng = 50, burnin = 5, typeNames = f$typeNames)
out  <- gjam(f$formula, f$xdata, f$ydata, modelList = ml)

ynames <- colnames(f$y)
group  <- ynames[types == 'OC']

full <- gjamSensitivity(out)
cc   <- gjamSensitivity(out, group)

nt <- ncol(full)

ylim <- range(rbind(full, cc))

boxplot( full, boxwex = 0.25,  at = 1:nt - .21, col='blue', log='y',
         ylim = ylim, xaxt = 'n', xlab = 'Predictors', ylab='Sensitivity')
boxplot( cc, boxwex = 0.25, at = 1:nt + .2, col='forestgreen', add=T,
         xaxt = 'n')
axis(1,at=1:nt,labels=colnames(full))
legend('bottomleft',c('full response','CC data'),
       text.col=c('blue','forestgreen'))

## End(Not run)

gjam documentation built on May 24, 2022, 1:06 a.m.