Hi Antigoni.

The other responders are correct, but just to be a little more concrete:

# using ape & nlme
library(ape); library(nlme)
# assuming your data are contained in named vectors x & y
y<-y[names(x)]
fit<-gls(y~x,data.frame(x,y),correlation=corPagel(1,tree,fixed=FALSE),method="ML")
# assuming your data are in data frame X, with column names var1,
# var2, etc.; for example:
fit<-gls(var1~var2+var3,X,correlation=corPagel(1,tree,fixed=FALSE),method="ML")

# using caper
library(caper)
# assuming your data are in named vectors x & y
y<-y[names(x)]
X<-data.frame(x,y,Species=names(x))
fit<-pgls(y~x,comparative.data(tree,X,"Species"),lambda="ML")

# using phytools
library(phytools)
# assuming your data are in named vectors x & y
fit<-phyl.resid(tree,x,y,method="lambda")

Although I am the author of phytools, I would say that the first two options should be preferred in general because they can be used with generic functions such as summary & residuals. (With the *possible* exception that phyl.resid seems to be a little bit faster on large trees. pgls in caper, for instance, took more than 4 min. to run a tree of 1000 tips on my computer.)

I hope this helps.

All the best, Liam


Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 11/28/2012 12:02 PM, Antigoni Kaliontzopoulou wrote:
Hello everyone,

I am trying to implement Liam Revell's suggestion on the evaluation of
Pagel's lambda simultaneous to fitting PGLS to minimize the effects of
wrong model selection (OLS vs. PGLS) on species data (i.e. Revell 2010,
Methods in Ecology and Evolution 1: 319-329).

Does anyone know if this kind of simultaneous optimization of lambda and
PGLS parameters is presently implemented in R? The obvious place would
be phytools, but I could not find anything similar in that package.

I would be grateful if you can provide any suggestions.

Antigoni


_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to