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

1 2 3 |

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

`tree2` |
A phylo tree object or a phylogenetic covariance matrix for the columns of |

`covars1` |
A matrix of covariates (e.g., traits) for the row species of |

`covars2` |
A matrix of covariates (e.g., traits) for the column species of |

`bootstrap` |
logical, bootstrap confidence intervals of the parameter estimates |

`nreps` |
Number of bootstrap replicated data sets to estimate parameter CIs |

`maxit` |
as in |

`pstart` |
starting values of the two phylogenetic signal strength parameters passed to |

`x` |
object of class |

`tree1.w.novel` |
A phylo tree object or a phylogenetic covariance matrix which corresponds to |

`tree2.w.novel` |
A phylo tree object or a phylogenetic covariance matrix which corresponds to |

`predict.originals` |
if |

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).

`MSE` |
total, full (each |

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

`phylocovs` |
phylogenetic covariance matricies scaled by the estimated |

`cors.1` |
correlations among predicted and observed associations for species of |

`cors.2` |
correlations among predicted and observed associations for species of |

`pred.novels1` |
predicted associations for the novel speices of |

`pred.novels2` |
predicted associations for the novel speices of |

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).

Matthew Helmus mrhelmus@gmail.com

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

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 29 30 31 | ```
## Not run:
#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
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.