gjamSpec2Trait: Ecological traits for gjam analysis

View source: R/gjamSpec2Trait.r

gjamSpec2TraitR Documentation

Ecological traits for gjam analysis

Description

Constructs community-weighted mean-mode (CWMM) trait matrix for analysis with gjam for n observations, S species, P traits, and M total trait levels.

Usage

  gjamSpec2Trait(pbys, sbyt, tTypes)

Arguments

pbys

n x S plot by species matrix (presence-absence, abundance)

sbyt

S x P species by trait matrix

tTypes

P data types for trait columns

Details

Generates the objects needed for a trait response model (TRM). As inputs the sbyt data.frame has P columns containing numeric values, ordinal scores, and categorical variables, identified by data type in tTypes. Additional trait columns can appear in the n x M output matrix plotByCWMM, because each level of a category becomes a new 'FC' column as a CWMM. Thus, M can exceed P, depending on the number of factors in sbyt. The exception is for categorical traits with only two levels, which can be treated as (0, 1) censored 'CA' data.

As output, the CWMM data types are given in traitTypes.

The list censor = NULL unless some data types are censored. In the example below there are two censored columns.

A detailed vignette on trait analysis is obtained with:

browseVignettes('gjam')

Value

plotByCWM

n x M matrix of community-weight means (numeric) or modes (ordinal)

traitTypes

character vector of data types for traits

specByTrait

S x M matrix translates species to traits

censor

list of censored columns, values, and intervals; see gjamCensorY

Author(s)

James S Clark, jimclark@duke.edu

References

Clark, J.S. 2016. Why species tell us more about traits than traits tell us about species: Predictive models. Ecology 97, 1979-1993.

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

gjam, gjamCensorY

Examples

## 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

ml  <- list(ng=2000, burnin=500, typeNames = tTypes, censor = censor)
out <- gjam(~ temp + stdage + deficit, xdata, ydata = traity, modelList = ml)
gjamPlot( output = out )         

## End(Not run)

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