Description Usage Arguments Details Value Note Author(s) References See Also Examples
Fit the presence/absence of species across communities to environmental, trait and phylogenetic data with generalized linear mixed models.
1 2 3 |
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 |
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 |
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 |
|
exitcountermax |
Number of iterations to estimate the fixed effect coefficients with penalized quasilikelihood and the variances of the random effects with restricted maximum likelihood |
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.
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? |
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.
Matthew Helmus <mrhelmus@gmail.com> and Anthony Ives <arives@wisc.edu>
Ives A.R. & Helmus M.R. (2011). Generalized linear mixed models for phylogenetic analyses of community structure. Ecological Monographs, 81, 511-525.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.