Re: [R-sig-phylo] utilise more data by making polytomies

2014-02-25 Thread Julien Clavel
Hi, There is also the stickTip function: http://rleca.pbworks.com/w/file/fetch/40813743/stickTips_1.2.html it is possible to tweak the code for more specific things... Best, Julien From: liam.rev...@umb.edu Date: Tue, 25 Feb 2014 10:32:36 -0500 To: h.ferguson-...@ucl.ac.uk;

Re: [R-sig-phylo] OU rescale of a tree

2014-04-08 Thread Julien Clavel
Hi Nicolas, Are you sure you can't use geiger fitContinuous function? For non-ultrametric trees branch length transformations are just bad (for OU process), but it seems to me that fitContinuous use a transformation of the vcv matrix (ouMatrix in their code). Best regards, Julien From:

Re: [R-sig-phylo] OU rescale of a tree

2014-04-09 Thread Julien Clavel
1.0.2 - 2014 - Julien Clavel - julien.cla...@hotmail.fr/julien.cla...@univ-lyon1.fr--*/ #include R.h #include Rmath.h #include Rdefines.h static void mvmorph_covar_OU(int *nt, double *A, double *ans

Re: [R-sig-phylo] Early burst branch rescale

2014-06-02 Thread Julien Clavel
Hi Jon, Take a look at the mvSHIFT function in mvMORPH. This is typically what you are looking for and you can use it with non-ultrametric trees (it's maybe faster than classic functions). Best, Julien Date: Mon, 2 Jun 2014 14:55:06 -0500 From: mitchel...@uchicago.edu To:

Re: [R-sig-phylo] Rescaling trees

2014-11-05 Thread Julien Clavel
2014, at 19:44, Julien Clavel wrote: Hi Lara, You can use the make.era.map function in phytools to slice your tree in simmap like format. Then you multiply the mapped time slices by the required rate (eg, tree$mapped.edge[,1]*sigma) and then use tree$edge.length-rowSum(tree$mapped.edge

Re: [R-sig-phylo] Rescaling trees

2014-11-05 Thread Julien Clavel
. Basically I would like to visualize trait evolution in which each time period has a different alpha and sigma2. I still haven't find a way but I will explore the options in phytools then, thanks. Lara On 3 Nov 2014, at 19:44, Julien Clavel wrote: Hi Lara, You can use

Re: [R-sig-phylo] Off-diagonal elements in multivariate OU evolution

2015-05-06 Thread Julien Clavel
Hi Cody, Maybe in your case you are rather interested in testing whether there is significant interaction in the selection strength (i.e. you constrain the alpha matrix but not the sigma matrix) than testing for significant correlations between traits? e.g. mvOU(tree, data, model=OU1,

Re: [R-sig-phylo] Off-diagonal elements in multivariate OU evolution

2015-05-06 Thread Julien Clavel
? __ Cody Dey codyj...@gmail.com On Wed, May 6, 2015 at 9:51 AM, Julien Clavel julien.cla...@hotmail.fr wrote: Hi Cody, Maybe in your case you are rather interested in testing whether there is significant interaction in the selection strength (i.e

Re: [R-sig-phylo] Off-diagonal elements in multivariate OU evolution

2015-05-05 Thread Julien Clavel
Hi Cody, Yes you can use this approach to test whether there is a significant interaction between traits toward the optimum. Alternatively you can sum the log-likelihood of two separate univariate analysis for the independent analysis.The estimated variance-covariance matrix is probably near

Re: [R-sig-phylo] PGLS vs OUwie?

2015-05-05 Thread Julien Clavel
Hi William, �ouch� and �OUwie� are based on Generalized Least Squares (GLS). Indeed, �generalized� mean that we can fit a linear model with between species hierarchical structure ( given e.g. by interspecies evolutionary variances-covariances according to an

Re: [R-sig-phylo] Constraining node values in an OUCH analysis

2015-06-04 Thread Julien Clavel
Hi Nathan, Although it is still possible to impute the missing data prior to the analysis, you can fit multivariate models with missing cases (NA values), using the mvMORPH (development version) from my gitHubhttps://github.com/JClavel/mvMORPH/ Non-ultrametric trees (trees with fossil species)

Re: [R-sig-phylo] Non Parametric PGLS

2015-06-19 Thread Julien Clavel
readings? Cheers, Santiago On Jun 18, 2015, at 7:06 PM, Julien Clavel julien.cla...@hotmail.fr wrote: Hi Sergio, Just to precise that you have to keep in mind that Mosimann ratio (if you are speaking about the Mosimann shape ratio, e.g. with the geometric mean) applies only when

Re: [R-sig-phylo] Non Parametric PGLS

2015-06-18 Thread Julien Clavel
Hi Sergio, Just to precise that you have to keep in mind that Mosimann ratio (if you are speaking about the Mosimann shape ratio, e.g. with the geometric mean) applies only when there is an isometric relationship (as for most analysis based on ratio). You should check first, otherwise the

Re: [R-sig-phylo] clade-specific release and radiate model?

2015-05-31 Thread Julien Clavel
On May 29, 2015, at 3:44 PM, Julien Clavel julien.cla...@hotmail.fr wrote: Hi Dan, Fitting models with two distinct modes of trait evolution is possible with the mvSHIFT function in mvMORPH. You just need to map on the tree the two clades (or selective regimes, groups... otherwise

Re: [R-sig-phylo] clade-specific release and radiate model?

2015-05-29 Thread Julien Clavel
Hi Dan, Fitting models with two distinct modes of trait evolution is possible with the mvSHIFT function in mvMORPH. You just need to map on the tree the two clades (or selective regimes, groups... otherwise) of interest rather than two times periods. The mapping can easily be done using the

Re: [R-sig-phylo] testing for variation in rates of evolution among traits

2015-07-17 Thread Julien Clavel
Hi Karla, Here a short simulated example of covarying traits just to illustrate the general workflow: library(mvMORPH)set.seed(14) # Simulate a 50 tips treetree-pbtree(n=50)# Simulate correlated body size and wing size traits (on empirical data you must log-transform the

Re: [R-sig-phylo] testing for variation in rates of evolution among traits

2015-07-17 Thread Julien Clavel
Hi Karla, Here a short simulated example of covarying traits just to illustrate the general workflow:   library(mvMORPH) set.seed(14) # Simulate a 50 tips tree tree-pbtree(n=50) # Simulate correlated body size and wing size traits (on empirical data you must log-transform the data)

Re: [R-sig-phylo] Question on pCCA (phyl.cca)

2015-10-14 Thread Julien Clavel
logenetic > residual error > > If you have collinearity, then you may not be able distinguish between > the effects of different variables - but this will be true for all > statistical models. (Imagine the worst case in which variables A & B > were perfectly collinear, wel

Re: [R-sig-phylo] Question on pCCA (phyl.cca)

2015-10-14 Thread Julien Clavel
: >> >> acoustic variable Z ~ environmental variable A + all other >> environmental variable + all other acoustic variables + phylogenetic >> residual error >> >> If you have collinearity, then you may not be able distinguish between >> the effects of dif

Re: [R-sig-phylo] Question on pCCA (phyl.cca)

2015-10-17 Thread Julien Clavel
Hi Krzysztof, I agree with you that if you want to test explicitly adaptation in a regression framework (i.e. environmental variables as predictors), slouch/mvslouch is more sounding than doing a simple regression ((p)GLS) or multiple regression.  I emphasize here that the coefficients of a

Re: [R-sig-phylo] Question on pCCA (phyl.cca)

2015-10-15 Thread Julien Clavel
ant (p-value = 0.16). > > Overall i get much less significant correlations with this method > compared to pGLS. Is there an explanation? Could it be a problem of > over-parametrisation? > > Best, > Sandra. > > > 2015-10-14 13:37 GMT-03:00 Julien Clavel > <julien.cla...@ho

Re: [R-sig-phylo] Question on pCCA (phyl.cca)

2015-10-13 Thread Julien Clavel
Hi Sandra, I think, a multivariate correlational model with your continuous traits as response variables can be used to do what you want. For instance, assuming Brownian motion: library(mvMORPH) set.seed(123) ## First simulate some data (3 traits) # simulate a tree tree <- pbtree(n=100) #

Re: [R-sig-phylo] Fwd: rate units in fitContinuous

2015-12-08 Thread Julien Clavel
Yes Karla, I think this is clearly stated in the paper to which Josef is referring. Julien De : R-sig-phylo de la part de Karla Shikev Envoyé : mardi 8 décembre 2015 11:57 À :

Re: [R-sig-phylo] root in mvOU

2016-06-18 Thread Julien Clavel
Further details on the various parameterizations options can be found in the package vignette: https://cran.r-project.org/web/packages/mvMORPH/vignettes/How_to_use_mvMORPH.pdf All the best, Julien ________ De : Julien Clavel <julien.cla...@hotmail.fr> Envoy� : vendredi 4

Re: [R-sig-phylo] root in mvOU

2016-03-04 Thread Julien Clavel
Hi Jarod, In fact you can either choose a fixed root, or a draw from a multivariate normal with the stationary covariance (random root). I will change the name of the options in an upcoming release (and on gitHub) to make it more explicit and make it homogeneous with univariate implementations

Re: [R-sig-phylo] comparing rates of evolution of a phenotypic trait among clades

2017-07-23 Thread Julien Clavel
Hi Karla, Here is a way to compare nested models in order to assess the significance of rate differences for a given tree and mapped regimes (in a similar fashion to what is proposing Liam). # Here a function to collapse the regimes mappedTrees <- function(tree, names){ combined <-

Re: [R-sig-phylo] remove phylogenetic signal from large dataset

2018-05-23 Thread Julien Clavel
Hi Frantz, The attached code can run the phylogenetic PCA (computes the scores) in few seconds on a species tree with more than 5000 tips. Note however that the phylogenetic pca is not exactly "removing" the phylo signal. It is a rigid rotation of what you obtain with the conventional PCA. You

Re: [R-sig-phylo] understanding variance-covariance matrix

2018-08-26 Thread Julien Clavel
Hi Agus, I just posted some courses I did a while ago to understand the variances and covariances of a BM process on trees and time-series (R markdown): https://github.com/JClavel/Examples This is also based on the previous mentioned references illustrated

Re: [R-sig-phylo] quantitative state dependent diversification of another quantitative trait

2018-04-04 Thread Julien Clavel
Hi Zach, In addition to SLOUCH (for a OU tracking a BM process) you can use mvMORPH for fitting a model where a trait evolving under an OU process follow another trait evolving under OU with some evolutionary lag (see p. 14-15 of the package vignette �How to use mvMORPH�). Best wishes,

Re: [R-sig-phylo] pgls_different_pacakges_different_results

2020-01-17 Thread Julien Clavel
Hello J�r�mie, Hard to say without a working example, but here are some hints: * Check if you�re using the same function to optimize (e.g. ML vs REML) * Are you comparing the same tests? (t or F tests, type of sums of squares) * Are you using non-ultrametric trees? In �nlme� for

Re: [R-sig-phylo] evolutionary rate for species with low phylogenetic signal

2020-09-24 Thread Julien Clavel
Hi Karla, As pointed out by Liam you can account for the sampling error with fitContnuous. Pagel's lambda corresponds to BM + noise at the tips (e.g. sampling error). If after accounting for this nuisance (for a set of competitive models) you find that BM is better than the other models, then

Re: [R-sig-phylo] Rphylopars changing observed data values

2020-07-20 Thread Julien Clavel
Dear Nick, Although within-species error is not treated in the same way as in Rphylopars you can also impute missing values (and estimate ancestral states) for most multivariate models implemented in mvMORPH using the "estim" function (see ?estim). Best wishes, Julien De : R-sig-phylo de

Re: [R-sig-phylo] regression slopes

2020-06-28 Thread Julien Clavel
Dear Karla, There are several options for classical phylogenetic regressions. For instance, the �gls� function from nlme package with the �corStruct� objects from ape, the function �phylolm� from the package of the same name or �pgls� in caper to name a few. For multivariate data you can use

Re: [R-sig-phylo] phylogenetic correlation analysis

2021-06-13 Thread Julien Clavel
Dear Oliver,    Yes, you can use the independent contrasts to estimate the correlations (e.g., assuming BM). Otherwise, you can compute the correlations directly from the models fit in mvMORPH.    For instance, under BM you can use:    fit_bm <- mvBM(tree, data)  cov2cor(fit_bm$sigma) # marginal

Re: [R-sig-phylo] If my trait X cannot be regressed by body size, how can I rescue residuals corrected by the phylogeny and SE?

2021-05-27 Thread Julien Clavel
Hello Gabriel, If I understand it correctly you're looking for an 'intercept only' model (e.g., gls(x~1,...)). The rationale for doing so would be to assess the 'phylogenetic signal' in your trait 'x'. It will be somehow similar to using functions such as, for instance, fitContinuous in

Re: [R-sig-phylo] If my trait X cannot be regressed by body size, how can I rescue residuals corrected by the phylogeny and SE?

2021-05-28 Thread Julien Clavel
I agree with the others, if your goal is to control for size/mass then I don’t see how the “residuals” from an intercept only model will be useful.  If the relationship between your trait and size is almost isometric, ratios are the simplest way to go. For ANOVAs, I will simply use size as a

Re: [R-sig-phylo] question regarding PGLS

2021-05-30 Thread Julien Clavel
Hi Oliver, The "gls" from nlme uses REML by default. I think that caper or phylolm use ML instead. On small sample size ML estimates (e.g., "lambda") are known to be biased and you may sometimes not have enough power to estimate them. With increasing sample size (bigger trees) this is less an

Re: [R-sig-phylo] question regarding PGLS

2021-05-31 Thread Julien Clavel
l and you have a non-ultrametric tree, you need to use the weights argument to pass the tip heights. Otherwise gls() assumes the tree is ultrametric. This could be part of the problem. I wrote a post about this in this forum several years ago, but I can no longer find it in the archive. The R

Re: [R-sig-phylo] Model Selection and PGLS

2021-07-04 Thread Julien Clavel
the prediction (see the references above). Cheers, Julien De : Russell Engelman Envoyé : jeudi 1 juillet 2021 06:20 À : Julien Clavel Cc : Theodore Garland ; Cecile Ane ; mailman, r-sig-phylo Objet : Re: [R-sig-phylo] Model Selection and PGLS   Dear All, What you see is the large uncer

Re: [R-sig-phylo] Model Selection and PGLS

2021-07-04 Thread Julien Clavel
I think that Cécile' and Theodore' point is important and too often overlooked. Using GLS models, the BLUP (Best Linear Unbiased Prediction) is not simply obtained from the fitted line but should incorporates information from the (evolutionary here) model. For multivariate linear model you

Re: [R-sig-phylo] Testing between categories with species values in each one

2021-04-09 Thread Julien Clavel
Hi Juan, I think that what you need in this case is a repeated measures design. There's probably fancy functions around to perform it, but I guess this should be possible to do with the “nlme” package and the corClasses from ape. Here a contrived example to show how it works (If I did it

Re: [R-sig-phylo] Testing between categories with species values in each one

2021-04-14 Thread Julien Clavel
een the “repeated measures” for that factor. You’ll have to provide contrasts matrix for these predictors though. You can find more about contrasts coding in Rencher 2002 or Fox 2016 books for instance. Hope it helps, Julien De : Juan Jose Lagos Oviedo Envoyé : lundi 12 avril 2021 15:38 À : Julie

Re: [R-sig-phylo] Irregularity in PGLS Slope Driven By Scope of Taxon Selection

2021-10-21 Thread Julien Clavel
”). If you have only information about the variance for some species maybe you can still approximate the value for the others by using a pooled estimate? Best wishes, Julien De : Russell Engelman Envoyé : vendredi 22 octobre 2021 00:54 À : Julien Clavel ; mailman, r-sig-phylo Objet : Re: [R

Re: [R-sig-phylo] Question regarding PGLS in caper

2021-10-19 Thread Julien Clavel
Hi Oliver, Your model comparison tells you that the "lambda" is better than "kappa", and hence that it should provides a better phylogenetic structure for the corresponding regression test. Making a model comparison to choose the structure is probably best practice, but it also depends on the

Re: [R-sig-phylo] Irregularity in PGLS Slope Driven By Scope of Taxon Selection

2021-10-20 Thread Julien Clavel
Hi Russell, Just a hint, but this type of bias (assuming there’s no formatting issues with the data), often shows up when there’s considerable (non-random) errors in the predictors (we talk about "error in variable models"). If you plot the residuals against your predictor they will likely be

Re: [R-sig-phylo] Including intraspecific variation (SE) in geiger::fitContinousMCMC

2023-06-01 Thread Julien Clavel
Hi Diogo, If you have an idea of the distribution of this fossil value, you should probably use an mcmc sampler to fit the model and provide priors on this root state (I can show you how to do this with any general-purpose sampler). Otherwise, if you want to constrain the model on a single