pglmm: Phylogenetic Generalized Linear Mixed Model

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Fit the presence/absence of species across communities to environmental, trait and phylogenetic data with generalized linear mixed models.

Usage

1
2
3
pglmm.sim(tree,nsites=30,modelflag=1,figs=TRUE,second.env=TRUE,compscale = 1)
pglmm.data(modelflag=1,sim.dat=NULL,samp=NULL,tree=NULL,traits=NULL,env=NULL,Vcomp=NULL)
pglmm.fit(dat=NULL,Y=NULL,X=NULL,VV=NULL,sp.init=0.5,maxit=25,exitcountermax=50)

Arguments

tree

Object of class phylo or a phylogenetic covariance matrix

nsites

Number of sites to simulate

modelflag

A number 1 - 5 indicating data set structure and corresponding to one of the models in Ives and Helmus (2011)

figs

Generate figures

compscale

compscale

second.env

Simulate community data with two environmental covariates

sim.dat

Object from pglmm.sim

samp

Species (rows) by site (columns) community data matrix

traits

Species X trait data matrix

env

Site X environment data matrix

Vcomp

Species X species matrix of pairwise repulsion

dat

A list with Y, X and VV from pglmm.sim or similarly structured in the same way

Y

The dependent variable, a (species times site) X 1 matrix of 0 and 1

X

The independent variables, a (species times site) X (trait + environment) matrix

VV

A list of the covariance matrices one for each random effect

sp.init

Initial values of the variances of the random effects (e.g., phylogenetic signal)

maxit

maxit in optim used to estimate the GLMM

exitcountermax

Number of iterations to estimate the fixed effect coefficients with penalized quasilikelihood and the variances of the random effects with restricted maximum likelihood

Details

Phylogenetic Generalized Linear Mixed Models (PGLMM) are generalized linear mixed model designed to test for phylogenetic patterns in community structure. Five models are implemented here and are designed to address (1) phylogenetic patterns in community structure, (2) phylogenetic variation in species sensitivities to environmental gradients among communities, (3) phylogenetic repulsion in which closely related species are less likely to co-occur, (4) trait-based variation in species sensitivities to environmental gradients, and (5) the combination traits and phylogeny to explain the variation in species occurrences among communities. Many other models can be designed by differently structuring the independent variable (Y), dependent variables (X), and covariance matrices (VV). This can be done by either editing the pglmm.data code or designing these objects by hand with custom code.

Value

pglmm.sim returns a list with items:

Vphylo

Phylogenetic covariance matrix

Vcomp

Repulsion matrix

Y

Community presence/absence matrix

X

Probabilities of a species being found in a community

u

Environmental gradient

bspp1

Species tolerances to environmental gradient 1 (phylogenetic signal)

bspp2

Species tolerances to environmental gradient 2 (no phylogenetic signal)

pglmm.data returns a list with items:

YY

Independent variable

VV

Covariance matrices for the random effects

XX

Dependent variables

pglmm.fit returns a list with items:

B

Coefficient estimates

B0

Initial estimates of the coefficients

s

The estimates of the scaling parameters (fitted variances) for the random effects (e.g., estimate of phylogenetic signal in community composition)

LL

Log likelihood of the final fitted PGLMM

flag

Did the estimation procedure converge?

Note

The estimation procedure can be slow especially for large data sets. Thus, start with a low value for exitcountermax to test if the data and model seem to be correctly structured. Then increase exitcountermax to get convergence. It behooves the user to fully understand the structure of the covariance matrices especially when designing complicated model structures. See Ives and Helmus (2011) for a discussion.

Author(s)

Matthew Helmus <mrhelmus@gmail.com> and Anthony Ives <arives@wisc.edu>

References

Ives A.R. & Helmus M.R. (2011). Generalized linear mixed models for phylogenetic analyses of community structure. Ecological Monographs, 81, 511-525.

See Also

phylostruct

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
modelflag=1
sim.dat<-pglmm.sim(stree(16, "balanced"),nsites=30,modelflag=modelflag,second.env=TRUE,compscale=1)
str(sim.dat)

dat<-pglmm.data(modelflag=modelflag,sim.dat=sim.dat)
str(dat)

#A low number of iterations, maxit = 25 is probably good for most data sets,
# but exitcountermax may need to be increased depending on matrix sizes
out<-pglmm.fit(dat=dat,maxit=25,exitcountermax=30)
# The first row gives the estimate of phylogenetic signal,
#  and the second an estimate of how strongly species
#  richness varies across communities. This later parameter
#  is likely biologically uninformative for most research questions.
str(out)
out$s 

## End(Not run)

picante documentation built on May 2, 2019, 6:30 p.m.