Re: [R-sig-phylo] phylogenetic circular linear regression

2017-07-27 Thread Peter Smits
Hi,

If your adventurous you could probably write your own model  in R or Stan
or similar. The wrapped Normal or the Von Mise distribution are circular
and map from 0 to 2pi. My suggestion would be to include a species level
phylogenetic "random effect" for the mean parameter to account for the
autocorrelation. This is how the MCMCglmm package includes phylogeny.

If you write it as sampling statements it might look like

y ~ MV(mu, k)
mu = a + bx + h
h ~ MVN (Mu, Sigma)

Hope that helps lead you on the right track.

Cheers,

Peter


On Thu, Jul 27, 2017, 4:07 AM f.k...@mailbox.org  wrote:

> Hi all,
>
> it there something like a phylogenetic circular linear regression or such?
>
> I want to test if the hue (circular 360°) of species differs between two
> lifestyles?
>
> Hope someone can help?
>
> If this is not there please also let me know.
>
> Cheers,
> Franz
>
> ___
> 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/

-- 
Peter D Smits
Postdoctoral Researcher (Finnegan lab)
Integrative Biology
University of California Berkeley
https://psmits.github.io/

[[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] A perfect storm: phylogenetic trees, random effects and zero-inflated binomial data

2015-06-03 Thread Peter Smits
The alternative to MCMCglmm would be to use stan or bugs for writing your
own sampling statement + priors. You'll have more control than with
MCMCglmm, but it will have even more of a learning curve.

Using stan will also most likely be faster than using any single R package.

Cheers,

Peter

On Wed, Jun 3, 2015 at 10:25 AM, Diederik Strubbe 
diederik.stru...@uantwerpen.be wrote:

 Dear all,



 I am struggling with analysing a dataset aimed at explaining invasion
 success of non-native species. At a country level, I need to relate
 invasion success (binomial: 0 for failed invasions, 1 for success) to
 socio-economic variables, taking into account

 -  Phylogenetic relatedness among introduced species: including
 a phylogenetic tree

 -  Country as a random effect

 -  The fact that data are zero-inflated (most introductions fail).



 Any suggestions for R packages that can handle a binomial response
 variable, phylogenetic trees, random effects and zero-inflation?



 Thanks in advance,



 Diederik

 --
 Dr.Diederik Strubbe
 Evolutionary Ecology Group
 Department of Biology
 University of Antwerp
 Middelheimcampus GV310
 Groenenborgerlaan 171
 2020 Antwerpen, Belgium
 office: +32 3 265 34 69
 mobile phone: +32 477445568
 skype user name: lakrinn


 [[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/

 --
 Peter D Smits
 Grad student
 Committee on Evolutionary Biology
 University of Chicago
 psm...@uchicago.edu
 http://home.uchicago.edu/~psmits/home.html
  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/


Re: [R-sig-phylo] Multi-Predictor ANOVA?

2015-02-04 Thread Peter Smits
Quick correction: index variables are transformed into n x (k - 1) matrices
of INDICATOR variables.

On Wed, Feb 4, 2015 at 5:25 PM, Peter Smits psm...@uchicago.edu wrote:

 Hi Will,

 Quick answer to that question: yes.

 The key is that categorical variables cannot be modeled directly in a GLM
 framework. These categorical variables, or index variables, are transformed
 into n x (k - 1) matrices of index variables. These index variables are
 binary where a 1 corresponds to the observed having that state. K is the
 number of states in the index variable. Only k - 1 columns are necessary
 because the intercept of the model corresponds to the remaining state. The
 interpretation of the beta coefficients for each of the (k - 1) predictors
 are then their contrast to or difference between that state and the state
 held by the intercept.

 R will do this silently when you fit the model.

 If all k states are included while also including an intercept term, the
 model becomes unidentifiable because you've effectively included two
 intercept terms which are additively non-identifiable.

 I hope that makes sense.

 Cheers,

 Peter

 On Wed, Feb 4, 2015 at 5:20 PM, William Gearty wgea...@stanford.edu
 wrote:

 Hi Liam,

 Thanks for the help!
 Does this type of linear model work if X1 and X2 are categorical
 variables?

 -Will

 On Wed, Feb 4, 2015 at 2:48 PM, Liam J. Revell liam.rev...@umb.edu
 wrote:

  Hi William.
 
  You should be able to fit this kind of model using gls in the nlme
  package. In your case, this would look something like:
 
  library(ape)
  library(nlme)
  fit-gls(Y~X1*X2,data,correlation=corBrownian(1,tree))
  anova(fit)
 
  for instance. This is just a linear model with multiple predictors and
  residual error that is correlated according to the phylogeny.
 
  If you search R-sig-phylo for gls and/or nlme, or search the web for GLS
  and phylogenies, you should be able to find out more info.
 
  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 2/4/2015 5:38 PM, William Gearty wrote:
 
  Apologies if this has been asked before...
  I'm trying to perform a phylogenetic ANOVA with multiple predictors.
  I'm able to do a normal ANOVA with multiple predictors like this:
 
   aov(Y ~ X1 * X2, data)
 
 
  However, I'd like to account for phylogenetic relatedness and tried
 doing
  something similar with aov.phylo:
 
 aov(Y ~ X1 * X2, phy)
 
 
  However, the function yells at me:
 
   'formula' must be of the form 'dat~group', where 'group' is a named
  factor
  vector and 'dat' is a data matrix or named vector
 
   Therefore, it seems like aov.phylo is not built to perform a
  multi-predictor analysis like the normal aov function is.
  Are there any similar functions that would be able pull this off? Is
 there
  way around this with aov.phylo?
  Any thoughts would be greatly appreciated,
  Will
 
 


 --
 William Gearty
 PhD Student, Paleobiology
 Department of Geological and Environmental Sciences
 Stanford School of Earth Sciences
 people.stanford.edu/wgearty

 [[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/




 --
 Peter D Smits
 Grad student
 Committee on Evolutionary Biology
 University of Chicago
 psm...@uchicago.edu
 http://home.uchicago.edu/~psmits/home.html




-- 
Peter D Smits
Grad student
Committee on Evolutionary Biology
University of Chicago
psm...@uchicago.edu
http://home.uchicago.edu/~psmits/home.html

[[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/