Learn R Programming

pez (version 1.0-0)

scape: Simulate phylogenetic community structure across a landscape

Description

scape simulates communities that are phylogenetically structured

Usage

scape(tree, scape.size = 10, g.center = 1, g.range = 1, g.repulse = 1,
  wd.all = 150, signal.center = TRUE, signal.range = TRUE,
  same.range = TRUE, repulse = TRUE, center.scale = 1, range.scale = 1,
  repulse.scale = 1, site.stoch.scale = 0.5, sd.center = 1,
  sd.range = 1, rho = NULL, th = 8)

Arguments

tree
phylo object
scape.size
edge dimension of square landscape
g.center
strength of phylogenetic signal in species range centers
g.range
strength of phylogenetic signal in species range sizes
g.repulse
strength of phylogenetic repulsion
wd.all
niche width, larger values simulate broader range sizes
signal.center
simulate with phylosignal in range centers
signal.range
simulate with phylosignal in range size
same.range
make all range sizes equal
repulse
include phylogenetic repulsion in range centers
center.scale
adjust strength of phylogenetic attraction in range centers independent of g.center
range.scale
adjust strength of phylogenetic signal in range size independent of g.range
repulse.scale
adjust strength of phylogenetic repulsion independent of g.repulse
site.stoch.scale
adjust strength of random variation in species richness across sites
sd.center
sd in rnorm for the range centers, increase to get more variation in center values across species
sd.range
sd rnorm for the range sizes, increase to get more variation in range sizes across gradients
rho
Grafen branch adjustment of phylogenetic tree see corGrafen
th
probability threshold 10^-th above which species are considered present at a site

Value

  • Y presence/absence matrix

    index spatial coordinates for X and Y (stacked columns)

    X.joint full probabilities of species at sites, used to construct Y

    X1 probabilities of species along gradient 1

    X2 probabilities of species along gradient 2

    sppXs full probabilities of each species as an array arranged in a scape.size-by-scape.size matrix

    V.phylo initial phylogenetic covariance matrix from tree

    V.phylo.rho phylogenetic covariance matrix from tree scaled by Grafen if rho is provided

    V.center scaled by g.center phylo covariance matrix used in the simulations

    V.range scaled by g.range phylo covariance matrix used in the simulations

    V.repulse scaled by g.repulse phylo covariance matrix used in the simulations

    bspp1 species optima for gradient 1

    bspp2 species optima for gradient 2

    u the env gradients values for the two gradients

    wd the denominator for species ranges

Details

Simulates a landscape with species (i.e., tree tips) distributions dependent on a supplied phylogenetic tree. The amount and type of structure is determened by the signal parameters g.center, g.range and g.repulse. Parameters are based on an Ornstein-Uhlenbeck model of evolution with stabilizing selection. Values of g=1 indicate no stabilizing selection and correspond to the Brownian motion model of evolution; 01 corresponds to disruptive selection where phylogenetic signal for the supplied tree is amplified. See corBlomberg. Communities are simulated along two gradients where the positions along those gradients, g.center and range sizes g.range, can exhibit phylogenetic signal. Phylogenetic attraction is simulated in the g.center paramter, while repulsion in g.repulse. Both can be exhibited such that closly related species are generally found with similar range centers (phylogenetic attraction) but just not at the same site (phylogenetic repulsion). The function then returns probabilities of of each species across sites and the presence and absences of species based a supplied threshold, th, which can be increased to obtain more species at sites and thus increase average site species richness.

References

Helmus M.R. & Ives A.R. (2012). Phylogenetic diversity area curves. Ecology, 93, S31-S43.

See Also

sim.phy

Examples

Run this code
require(ape)
tree<-stree(8,type="balanced")       #signal in centers
kk<-scape(tree, scape.size=100, g.center=100, g.range=1, g.repulse=1, wd.all=150,
signal.center=TRUE, signal.range=FALSE, same.range=FALSE, repulse=FALSE,center.scale = 1,
range.scale = 1, repulse.scale = 1, site.stoch.scale = 0, sd.center=3, sd.range=1,rho=NULL, th=20)

#Make some plots
require(plotrix)
par(mfrow=c(1,Ntip(tree)),mar=c(.1,.1,.1,.1))
for(j in 1:Ntip(tree)){color2D.matplot(1 - kk$sppXs[,,j]/max(kk$sppXs[,,j]), xlab = "",
ylab = "",main = "",border=NA,do.hex=FALSE,axes=FALSE)}

par(mfrow=c(2,1))
matplot((kk$X1), type = "l", xlab="gradient",ylab = "probability",
main = "Gradient 1",col=rainbow(dim(kk$X1)[2]),lty=1)
matplot((kk$X2), type = "l", xlab="gradient",ylab = "probability",
main = "Gradient 2",col=rainbow(dim(kk$X2)[2]),lty=1)

plot(x=1:dim(kk$Y)[1],y = rowSums(kk$Y), main = "SR",type = "l")
cor(kk$X1)

Run the code above in your browser using DataLab