Re: [R-sig-phylo] How to test if the slope is different from 1 in PGLS?

2014-08-21 Thread Xavier Prudent
Hi Gustavo,

GLS returns the estimated slope and its uncertainty, you can then compute a
t-value where your null-hypothesis is "slope=1", and from that t-value get
a p-value.

Cheers,
Xavier


2014-08-20 21:30 GMT+02:00 Gustavo Paterno :

> Dear all,
> I am working with flower allometry and want to use PGLS to analyse how the
> male and female biomass of the flower scale with total flower biomass.
> So simple linear regressions, but log-trasformed.
>
> my model is:
> mod.male <- pgls(male~total, data=flower.data,lambda="ML")
>
> Besides calculating the slope of the regression I am also interested to
> test if the slope is different then 1. How can I do this in PGLS?
> I would be very glad if any one could help me with that.
>
> Kind regards,
> Gustavo Paterno
> -
> Gustavo B. Paterno
> Doutorando em Ecologia
> Departamento de Ecologia
> Universidade Federal do Rio Grande do Norte
> Natal, Brasil
> -
> skype: gustavopaterno
> pater...@cb.ufrn.br
>
>
>
>
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>



-- 


*---Xavier Prudent*


*Computational biology and evolutionary genomics*

*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*

*01187 Dresden *

*Max Planck-Institute for Molecular Cell Biology and Genetics*
*(MPI-CBG)*
*Pfotenhauerstraße 108  *
*01307 Dresden*



*Phone: +49 351 210-2621*

*Mail: prudent [ at ] mpi-cbg.de <http://mpi-cbg.de>*
*---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Phylogenetic regression available in R (Grafen, 1989)

2014-03-05 Thread Xavier Prudent
Hi Gustavo,
Thanks for that notification,
I may be wrong, but was'nt that method already implemented in the CAPER
package by David Orme (function pgls, brunch, crunch)?
If yes, then which new functionalities does phyreg bring?
Regards,
Xavier


2014-03-05 13:46 GMT+01:00 Gustavo Paterno :

> Hello all,
>
> I just got the confirmation that the Grafen method for phylogenetic
> regression (Grafen, 1989) was implemented in R !
> The package "phyreg" has lots of details in help.
>
> Best wishes for all.
> Gustavo Paterno
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>



-- 


*---Xavier Prudent*


*Computational biology and evolutionary genomics*

*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*

*01187 Dresden *

*Max Planck-Institute for Molecular Cell Biology and Genetics*
*(MPI-CBG)*
*Pfotenhauerstraße 108  *
*01307 Dresden*



*Phone: +49 351 210-2621*

*Mail: prudent [ at ] mpi-cbg.de <http://mpi-cbg.de>*
*---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] problem with corMartins (ape)

2013-08-01 Thread Xavier Prudent
Salut Sandra,

I have experienced that the matrix given by vcv can lead to wrong results
if taken as a correlation matrix in the case of trees where the tips do not
have the same lengths.
I then built my own correlation, using the common branch length shared by
two tips, normalized by this same length plus the lengths of the last
branches of these tips.
The diagonals being forced to zero.

If you are interested in it, I can send you the code,
cheers,
Xavier


2013/8/1 sandra goutte 

> Ok so i found out what i was doing wrong and i just answer my own post so
> nobody will waste time answering me: i was not making a proper weight
> matrix using vcv(), so i fixed the problem by using 1/distance matrix from
> this variance-covariance matrix and then fixing the sum of each row to 1.
> Now the Moran.I behaves as expected with random data for both OU and BM
> models.
>
> Sandra.
>
>
>
> 2013/7/29 sandra goutte 
>
> > Dear list,
> >
> > I am trying to run a gls with an OU correlation structure using
> > corMartins. I first wanted to check whether i had a phylogenetic
> > autocorrelation in my trait, so i used the Moran's I index (Moran.I):
> >
> > vcovm<-vcv(corMartins(1,tree, fixed=T))
> > Moran.I(trait, vcovm, alt="greater")
> >
> > And i obtained a p-value equal to zero. Changing the alpha parameter, i
> > kept getting p-values=0. For the Brownian motion however, i got a
> "normal"
> > p-value. I then tried with random values for my trait, and when for a
> > brownian correlation structure i get what i expect, that is most of the
> > time non-signiifcant autocorrelation, with the cor.Martins structure i
> > always get significant p-values (although not equal to zero).
> >
> > In addition, if i run the GLS with the corMartins structure like this:
> >
> > corm<-corMartins(1,phy=tree, fixed=T)
> > glsp<- gls(trait~var1+var2+var3, correlation=corm, data=data)
> >
> > i get better and better AIC for increasing the alpha parameter
> > (indefinitely!), which would mean that the stronger the constraint on the
> > trait, the better is the fit.
> >
> > Does anyone know why the corMartins is giving me these wierd results? Am
> I
> > using this function in the wrong way or is it a bugg?
> >
> > Thank you in advance for your help,
> > Sandra.
> >
> >
> >
> > --
> > PhD Student
> > Muséum National d'Histoire Naturelle
> > Département Systématique et Évolution
> > USM 601 / UMR 7205 Origine, Structure et Évolution de la Biodiversité
> > Reptiles & Amphibiens - Case Postale 30
> > 25 rue Cuvier
> > F-75005 Paris
> >
> > Tel :  +33 (0) 1 40 79 34 90
> > Mobile: +33 (0) 6 79 20 29 99
> >
>
>
>
> --
> PhD Student
> Muséum National d'Histoire Naturelle
> Département Systématique et Évolution
> USM 601 / UMR 7205 Origine, Structure et Évolution de la Biodiversité
> Reptiles & Amphibiens - Case Postale 30
> 25 rue Cuvier
> F-75005 Paris
>
> Tel :  +33 (0) 1 40 79 34 90
> Mobile: +33 (0) 6 79 20 29 99
>
> [[alternative HTML version deleted]]
>
>
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>



-- 
*---
Xavier Prudent
*
*
Computational biology and evolutionary genomics
*
*
*
*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*
*01187 Dresden
*
*
*
*Max Planck-Institute for Molecular Cell Biology and Genetics*
*
(MPI-CBG)
*
*
Pfotenhauerstraße 108
*
*
01307 Dresden
*
*

*
*
Phone: +49 351 210-2621
*
*Mail: prudent [ at ] mpi-cbg.de
**---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] question about measurement error in phylogenetic signal

2013-07-04 Thread Xavier Prudent
Dear Eliot,

One way to cope with the uncertainty on the inputs in an analysis is vary
these inputs by some amount (like +- 1 standard deviation) and rerun your
analysis. The spread of the result tells you then how robust your analysis
is.
Pay attention that the inputs may be varied in an independent way if they
ARE independent, if they highly correlated you may prefer to vary them
simultaneously.

Hope that helps,

Regards,
Xavier


2013/7/4 Eliot Miller 

> Hello all,
>
> I have been trying to get something to work in a number of different
> packages and with a number of different approaches today that I couldn't
> get to run in a believable way. Before I spend another day on this, I was
> wondering what people think about the idea in general.
>
> I have a dataset of disease prevalence across ~100 species. There are ~2000
> individuals total across the dataset, with >4 individuals per species.
> Prevalence per individual is coded as 0 or 1. I am interested in the
> phylogenetic signal of disease prevalence across the species. One approach
> that works is to simply calculate prevalence as the species-specific mean,
> i.e. if 3 individuals of 6 for a species had the disease, the prevalence
> would be 3/6 = 0.5. Then one can use these values with e.g. phylosig() (I
> arcsin sqrt transformed these proportions here). Like the few other
> published tests of phylogenetic signal in disease prevalence, there is
> little signal here. I could leave it at that, because in general there are
> very low detections in this dataset and it's probably not ideally suited to
> address this question anyhow.
>
> That aside however, because not all individuals of a given species always
> have the disease, I wanted to incorporate "measurement error". So, based on
> the calculation for SE for binary data from the site:
>
> http://www.researchgate.net/post/Can_standard_deviation_and_standard_error_be_calculated_for_a_binary_variable
> ,
> I also calculated a species-specific SEs as the
> sqrt(mean(prevalence)*((1-
> mean(prevalence))/individuals)).
>
> What do people think about this? It's hardly measurement error in the sense
> we normally mean it. On the other hand, I think it would be neat if there
> were some way to account for variation among individuals in prevalence, and
> the influence this has on phylogenetic signal.
>
> Cheers,
> Eliot
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>



-- 
*---
Xavier Prudent
*
*
Computational biology and evolutionary genomics
*
*
*
*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*
*01187 Dresden
*
*
*
*Max Planck-Institute for Molecular Cell Biology and Genetics*
*
(MPI-CBG)
*
*
Pfotenhauerstraße 108
*
*
01307 Dresden
*
*

*
*
Phone: +49 351 210-2621
*
*Mail: prudent [ at ] mpi-cbg.de
**---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] CI and PI lines for PGLS with Pagel's ML

2013-06-03 Thread Xavier Prudent
Dear Barry,
My first guess would be to use the likelihood profile provided as an output
of PGLS, and extract the (frequentists) intervals according to it.
http://www.jstor.org/stable/2985006
Hope that helps,
regards,
Xavier


2013/6/3 Simon Blomberg 

> I don't know about using Caper, but you will not get "phylogenetically
> independent" residuals by using the residual SSQ from the PGLS regression.
> The raw residuals of a PGLS are not uncorrelated. You can get approximately
> independent, uncorrelated residuals by pre-multiplying the (standardised)
> residuals by the inverse square root of the phylogenetic covariance matrix.
> If you use the nlme package to fit the pgls model, you can get these by
> specifying type="n" in residuals.gls().
>
>  Note that this will not really solve your problem. The reason is that it
> is hard to define what a confidence or prediction interval/band should look
> like for correlated data. This is because the interval depends not only on
> your explanatory variables, but also on the phylogenetic covariance of your
> (unknown, unmeasured) species.
>
> Sometimes you will find that there are things that R won't let you do
> easily because it really doesn't make much sense to do those things.
>
> Cheers,
>
> Simon.
>
>
> On 03/06/13 17:51, Barry Lovegrove wrote:
>
>> Dear all,
>>
>> I am trying to fit 95% confidence and prediction intervals (lines) to a
>> PGLS regression estimated with Pagel's ML branch length transformations for
>> a regression which I calculated in Caper. I can't seem to find a routine
>> for this. I can only find the param.CI command for estimating the CIs of
>> the transformation parameters.  To calculated intervals lines for an OLS 1
>> would use the residual sum of squares from the regression to calculate the
>> lines using, for example, equations  17.26 and 17.29 in Zar (1984). If I do
>> this using the RSSQ from the pgls regression will I get appropriate
>> phylogenetically independent residuals? I'd be grateful for some advice.
>>
>> Many thanks,
>>
>> Barry
>>
>>
>> Prof Barry G. Lovegrove
>> School of Life Sciences
>> University of KwaZulu-Natal
>> P/Bag X01 Scottsville
>> 3209
>> South Africa
>>
>> Tel: +27-33-2605113 (w)
>> Tel: +27-33-3423051 (h)
>> Cell: 0827810655
>> Fax: +27-33-2605105
>>
>> === Please find our Email Disclaimer here-->: http://www.ukzn.ac.za/*
>> *disclaimer <http://www.ukzn.ac.za/disclaimer> ===
>>
>> [[alternative HTML version deleted]]
>>
>> __**_
>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-phylo<https://stat.ethz.ch/mailman/listinfo/r-sig-phylo>
>> Searchable archive at http://www.mail-archive.com/r-**
>> sig-ph...@r-project.org/<http://www.mail-archive.com/r-sig-phylo@r-project.org/>
>>
>
>
> --
> Simon Blomberg, BSc (Hons), PhD, MAppStat, AStat.
> Lecturer and Consultant Statistician
> School of Biological Sciences
> The University of Queensland
> St. Lucia Queensland 4072
> Australia
> T: +61 7 3365 2506
> email: S.Blomberg1_at_uq.edu.au
> http://www.**evolutionarystatistics.org<http://www.evolutionarystatistics.org>
>
> Policies:
> 1.  I will NOT analyse your data for you.
> 2.  Your deadline is your problem.
>
> Statistics is the grammar of science - Karl Pearson.
>
>
> __**_
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-phylo<https://stat.ethz.ch/mailman/listinfo/r-sig-phylo>
> Searchable archive at http://www.mail-archive.com/r-**
> sig-ph...@r-project.org/<http://www.mail-archive.com/r-sig-phylo@r-project.org/>
>



-- 
*---
Xavier Prudent
*
*
Computational biology and evolutionary genomics
*
*
*
*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*
*01187 Dresden
*
*
*
*Max Planck-Institute for Molecular Cell Biology and Genetics*
*
(MPI-CBG)
*
*
Pfotenhauerstraße 108
*
*
01307 Dresden
*
*

*
*
Phone: +49 351 210-2621
*
*Mail: prudent [ at ] mpi-cbg.de
**---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

[R-sig-phylo] Very simple question on fitted values and scatterplots

2013-05-02 Thread Xavier Prudent
Dear all,

I went through this tutorial on the fit of a linear model using Independent
Contrasts
http://nunn.rc.fas.harvard.edu/groups/pica/wiki/c57f6/

What is the meaning of "fitted values" in the scatter plot (bottom, x-axis)?

Fitting a linear model with a constraint to the origin, so y = a * x, the
only fitted parameter is a.
Which does not make sense as we would not have one value per node, and we
would not expect these points to be spread for a "good" fit.

Thanks in advance,

regards,
Xavier


-- 
*-------
Xavier Prudent
*
*
Computational biology and evolutionary genomics
*
*
*
*Guest scientist at the Max-Planck-Institut für Physik komplexer Systeme*
*(MPI-PKS)*
*Noethnitzer Str. 38*
*01187 Dresden
*
*
*
*Max Planck-Institute for Molecular Cell Biology and Genetics*
*
(MPI-CBG)
*
*
Pfotenhauerstraße 108
*
*
01307 Dresden
*
*

*
*
Phone: +49 351 210-2621
*
*Mail: prudent [ at ] mpi-cbg.de
**---*

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] phylogenetic multiple correspondence analysis

2013-04-25 Thread Xavier Prudent
Dear Paolo,
Do you have any reference for this MCA method? I guess some related R
package must already exist.
Regards,
Xavier Prudent


2013/4/25 Paolo Piras 

> Hi,
> maybe you could perform a standard MCA and then you could use the scores
> as continuous vars in standard comparative methods (including phyl pca)
>
> dont know if this helps..
> best
> paolo
>
>
> 
> Da: r-sig-phylo-boun...@r-project.org [r-sig-phylo-boun...@r-project.org]
> per conto di Danny Rojas [rojasmartin...@gmail.com]
> Inviato: giovedì 25 aprile 2013 16.11
> A: r-sig-phylo@r-project.org
> Oggetto: [R-sig-phylo] phylogenetic multiple correspondence analysis
>
> Dear colleagues,
>
> Anybody know if there is an alternative to the phylogenetic principal
> component analysis of Revell (2009; Evolution 63-12: 3258–3268), let's
> say
> a phylogenetic multiple correspondence analysis, to analyze non-continuous
> variables? I would appreciate any suggestion.
>
> Thanks in advance.
>
> --
> Danny Rojas, Ph.D.
> Facultade de Bioloxía
> Universidade de Vigo
> http://rojasdanny.wordpress.com
>
> [[alternative HTML version deleted]]
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

[R-sig-phylo] degrees of freedom issue in pgls() 'caper'

2013-04-23 Thread Xavier Prudent
Dear all,

Apparently that thread has not been answered:
https://stat.ethz.ch/pipermail/r-sig-phylo/2012-October/002337.html

When performing an F-test and calculating a p-value, one needs the two
degrees of freedom for the F distributions, which are:

d1 = p - 1
d2 = n - p

with

p = number of free parameters
n = number of data points

I have 27 species,
so n = 27,
on which I apply a linear regression (Y ~ X), where Y is a categorical
variable and X is continuous,
so p = 2

hence:
d1 = 1
d2 = 25

when running pgls() I obtain

F-statistic: 0.7025 on 2 and 25 DF,  p-value: 0.5049

as you can see the first degree of freedom is different. If it is a mistake
then the quoted p-value is wrong!


Any input welcome,

cheers,
Xavier

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[R-sig-phylo] Pathological case for the function 'brunch' of CAPER?

2013-04-17 Thread Xavier Prudent
Dear R-enthusiats,

I guess my question suits (hopefully) more to this mailing list.

While using the regression fonction 'brunch' of CAPER (with R v2.15.4),

in a simple case (binary variable Yes/No vs. a continuous variable)

I ended with an unexplained error:

Error in if (any(stRes > robust)) { :
  missing value where TRUE/FALSE needed


I simplified my code so that you can run it, just copy everything in a
directory and run
source("analysis.R")

 > Code:
http://iktp.tu-dresden.de/~prudent/Divers/R/analysis.R

 > Tree:
http://iktp.tu-dresden.de/~prudent/Divers/R/vertebrates.tree

 > Data:
http://iktp.tu-dresden.de/~prudent/Divers/R/data.txt

The source of the error is the pruning, (particularly for these tips:

"cavPor3", "myoLuc1")

but after searching around I still have no clue of what is happening.

Any hint is welcome!

Thanks in advance,

Xavier

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


[R-sig-phylo] Why does the brunch method works also with discrete traits?

2013-04-09 Thread Xavier Prudent
Dear all,

As a newcomer in R I am playing around with CAPER and R to understand how
it works,
while testing for the correlation between discrete traits (t1, t2, t3) for
10 species:

s t1 t2 t3
s1 0 1 0
s2 0 0 0
s3 1 0 1
s4 0 0 0
s5 1 0 1
s6 0 0 0
s7 0 1 0
s8 1 0 1
s9 0 1 0
s10 1 1 1

(you may notice that t3=t1 in that exemple), I got an error message from
'brunch'

> mod = brunch(t1~t2, cd)
Error in brunch(t1 ~ t2, cd) : No factors specified in the model formula
> mod = crunch(t1~t2, cd)

and just tried 'crunch' by curiosity. Even though these variables are
binary, I obtained exactly the same result as with GLS.
That is extremely puzzling as I expected crunch to work only for binaries,
and if these results were wrong, then it would mean the GLS's one are wrong
also...

you can have a look at my code there:
http://iktp.tu-dresden.de/~prudent/Divers/R/toy.R

with the tree structure:
http://iktp.tu-dresden.de/~prudent/Divers/R/toy3.tree

Thanks in advance,

regards,

Xavier Prudent

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/