pblm: Phylogenetic Bipartite Linear Model

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

View source: R/pblm.R

Description

Fits a linear model to the association strengths of a bipartite data set with or without phylogenetic correlation among the interacting species

Usage

1
2
3
pblm(assocs, tree1=NULL, tree2=NULL, covars1=NULL, covars2=NULL, bootstrap=FALSE,
    nreps=10, maxit=10000, pstart=c(.5,.5))
pblmpredict(x, tree1.w.novel=NULL, tree2.w.novel=NULL, predict.originals=FALSE)

Arguments

assocs

A matrix of association strengths among two sets of interacting species

tree1

A phylo tree object or a phylogenetic covariance matrix for the rows of assocs

tree2

A phylo tree object or a phylogenetic covariance matrix for the columns of assocs

covars1

A matrix of covariates (e.g., traits) for the row species of assocs

covars2

A matrix of covariates (e.g., traits) for the column species of assocs

bootstrap

logical, bootstrap confidence intervals of the parameter estimates

nreps

Number of bootstrap replicated data sets to estimate parameter CIs

maxit

as in optim

pstart

starting values of the two phylogenetic signal strength parameters passed to optim

x

object of class pblm

tree1.w.novel

A phylo tree object or a phylogenetic covariance matrix which corresponds to tree1 of x with species to predict associations

tree2.w.novel

A phylo tree object or a phylogenetic covariance matrix which corresponds to tree2 of x with species to predict associations

predict.originals

if TRUE then the associations of each original species in the two phylogenies is predicted

Details

Fit a linear model with covariates using estimated generalized least squares to the association strengths between two sets of interacting species. Associations can be either binary or continuous. If phylogenies of the two sets of interacting species are supplied, two phyogenetic signal strength parameters (d1 and d2), one for each species set, based on an Ornstein-Uhlenbeck model of evolution with stabilizing selection are estimated. Values of d=1 indicate no stabilizing selection and correspond to the Brownian motion model of evolution; 0<d<1 represents stabilizing selection; d=0 depicts the absence of phylogenetic correlation (i.e., a star phylogeny); and d>1 corresponds to disruptive selection where phylogenetic signal is amplified. Confidence intervals for these and the other parameters can be estimated with bootstrapping.

The function pblmpredict predicts the associations of novel species following the methods given in appendix B of Ives and Godfray (2006).

Value

MSE

total, full (each d estimated), star (d=0), and base (d=1) mean squared errors

signal.strength

two estimates of phylogenetic signal strength

coefficients

estimated intercept and covariate coefficients with approximate 95 percent CIs for the three model types (full, star, base)

CI.boot

95 percent CIs for all parameters

variates

matrix of model variates (can be used for plotting)

residuals

matrix of residuals from the three models (full, star and base)

predicted

predicted associations

bootvalues

matrix of parameters estimated from the nreps bootstrap replicated data sets used to calculate CIs

phylocovs

phylogenetic covariance matricies scaled by the estimated d1 and d2

cors.1

correlations among predicted and observed associations for species of tree1, NA if predict.originals=FALSE

cors.2

correlations among predicted and observed associations for species of tree2, NA if predict.originals=FALSE

pred.novels1

predicted associations for the novel speices of tree1

pred.novels2

predicted associations for the novel speices of tree2

Note

Covariates that apply to both species sets (e.g., sampling site) should be supplied in the covariate matrix of the set with the most species.

Bootstrapping CIs is slow due to the function optim used to estimate the model parameters. See appendix A in Ives and Godfray (2006) for a discussion about this boostrapping procedure

If pblmpredict=TRUE the function does not first remove each species in turn when predicting the associations of the original species as is done in Ives and Godfray (2006).

Author(s)

Matthew Helmus mrhelmus@gmail.com

References

Ives A.R. & Godfray H.C. (2006) Phylogenetic analysis of trophic associations. The American Naturalist, 168, E1-E14

Blomberg S.P., Garland T.J. & Ives A.R. (2003) Testing for phylogenetic signal in comparative data: Behavioral traits are more labile. Evolution, 57, 717-745

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#load example data from Ives & Godfray (2006)
data(IvesGodfray)

#net attack rate of parasitoid on host eq.4 in Ives and Godfray
A<-(-1*log(1-IvesGodfray$interactions[,-28]/t(IvesGodfray$interactions[28])))

# Make tips of the phylogenetic trees contemporaneous by extending tips
p<-dim(IvesGodfray$host)[1]
q<-dim(IvesGodfray$parasitoid)[1]
host.cov.scaled<-IvesGodfray$host
para.cov.scaled<-IvesGodfray$parasitoid
for (i in 1:p)
{
  host.cov.scaled[i,i]<-max(host.cov.scaled)
}
for (i in 1:q)
{
  para.cov.scaled[i,i]<-max(para.cov.scaled)
}

# scale covariance matrices (this reduces numerical problems caused by
# determinants going to infinity or zero)
  host.cov.scaled<-host.cov.scaled/(det(as.matrix(host.cov.scaled))^(1/p))
  para.cov.scaled<-para.cov.scaled/(det(as.matrix(para.cov.scaled))^(1/q))

pblm.A <- pblm(sqrt(A),tree1=host.cov.scaled,tree2=para.cov.scaled)
pblm.A$signal.strength    #compare to Ives and Godfray (2006) Table 1 Line 1
pblm.A$MSE

picante documentation built on July 1, 2020, 10:57 p.m.