Re: [R-sig-phylo] phylogenetic correction for multiple samples per species along an ecological gradient

2018-08-03 Thread Nicolay Cunha
Hi everybody,

Many thanks for all your inputs. After some digging, I think that MCMCglmm
is a good way to go. However, I am an illiterate in Bayesian modelling and
will probably have to seek for advice elsewhere, like r-sig-mixed-model.

Cheers,
Nicolay

On Wed, Aug 1, 2018 at 10:28 AM Masahito Tsuboi 
wrote:

> Hi list,
>
> I second Jon's suggestion for using phylogenetic mixed model. This seems
> to be the closest to what Nicolay is after.
>
> Yet another option is "SLOUCH" package in R, which can handle
> within-species variation while performing phylogenetic corrections. Here
> are some example codes.
>
> *https://kopperud.github.io/slouch/articles/introduction.html
> *
>
> Hope you will find a suitable solution from one of those.
>
> Best,
> Masahito
>
> On 1 Aug 2018, at 14:37, jonnations  wrote:
>
> You will want to try Bayesian mixed modeling which can handle your species
> # problem by using “species” as a group level (i.e. “random”) effect. I
> would recommend r packages brms and MCMCglmm and their vignettes. Both have
> detailed “phylo” examples.
>
> Maybe check out the r-sig-mixed-model listserv as well. Lots of similar
> questions and good advice show up on there.
>
> Good luck!
> Jon
> --
> Jonathan A. Nations
> PhD Candidate
> Esselstyn Lab 
> Museum of Natural Sciences 
> Louisiana State University
>
> [[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/


Re: [R-sig-phylo] phylogenetic correction for multiple samples per species along an ecological gradient

2018-08-01 Thread Masahito Tsuboi
Hi list,

I second Jon's suggestion for using phylogenetic mixed model. This seems to be 
the closest to what Nicolay is after.

Yet another option is "SLOUCH" package in R, which can handle within-species 
variation while performing phylogenetic corrections. Here are some example 
codes. 

https://kopperud.github.io/slouch/articles/introduction.html 


Hope you will find a suitable solution from one of those.

Best,
Masahito

> On 1 Aug 2018, at 14:37, jonnations  wrote:
> 
> You will want to try Bayesian mixed modeling which can handle your species
> # problem by using “species” as a group level (i.e. “random”) effect. I
> would recommend r packages brms and MCMCglmm and their vignettes. Both have
> detailed “phylo” examples.
> 
> Maybe check out the r-sig-mixed-model listserv as well. Lots of similar
> questions and good advice show up on there.
> 
> Good luck!
> Jon
> -- 
> Jonathan A. Nations
> PhD Candidate
> Esselstyn Lab 
> Museum of Natural Sciences 
> Louisiana State University
> 
>   [[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/


Re: [R-sig-phylo] phylogenetic correction for multiple samples per species along an ecological gradient

2018-08-01 Thread jonnations
You will want to try Bayesian mixed modeling which can handle your species
# problem by using “species” as a group level (i.e. “random”) effect. I
would recommend r packages brms and MCMCglmm and their vignettes. Both have
detailed “phylo” examples.

Maybe check out the r-sig-mixed-model listserv as well. Lots of similar
questions and good advice show up on there.

Good luck!
Jon
-- 
Jonathan A. Nations
PhD Candidate
Esselstyn Lab 
Museum of Natural Sciences 
Louisiana State University

[[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 correction for multiple samples per species along an ecological gradient

2018-07-31 Thread f . krah
In R the PhyloPars package might be interesting. Haven’t used it... though. 
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2703881/
Cheers Franz 

Sent from my mobile

> On 31. Jul 2018, at 21:04, Nicolay Cunha  wrote:
> 
> Dear list members,
> 
> I would like to test a linear model between a predictor variable (e.g.
> altitude) and a dependent variable (e.g. number of flowers). For this, I do
> have several observations of individuals of 42 species along the predictor
> variable, but the number of observations do vary per each species and class
> of the independent variable. In the end, I do have 364 observations
> unbalanced per each of the 42 species and environment.
> 
> My intention is doing a model having the number of flower as dependent
> variable, the temperature as fixed effect, using species as a random factor
> and add a phylogenetic correction. I could do part of this this using GLS,
> but the fact of having multiple observations per species do not allow
> running the model and returns the following message:
> 
> 
> *“number of observations and number of tips in the tree are not equal.”*
> I would much appreciate if you could give me advices on how to overcome
> this issue and run such model.
> 
> Many thanks,
> 
> Nicolay
> 
> Grupo de Ecología de la Polinización, INIBIOMA,
> CONICET-Universidad Nacional del Comahue,
> Quintral 1250,  8400 San Carlos de Bariloche, Rio Negro, Argentina
> 
> #**#
> 
> # Below an example code
> 
> 
> 
> 
> 
> 
> *library(phytools)tree <- rtree(5, rooted = FALSE, tip.label =
> LETTERS[1:5])x <- data.frame(  spp = c(sample(c(LETTERS [1:3]),100,
> replace = T), sample(c(LETTERS [2:4]),100, replace =
> T), sample(c(LETTERS [3:5]),100, replace = T)),
>  alt = rep(c("1000", "1500", "2000"), each = 100),*
> 
> 
> 
> *  flower = rnorm(300)) library(nlme)fit <- gls(flower ~ alt,
> correlation = corPagel(1,tree, fixed=FALSE), method="ML", data = x) *
> 
> 
> #**#
> 
>[[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/


Re: [R-sig-phylo] phylogenetic correction for multiple samples per species along an ecological gradient

2018-07-31 Thread Theodore Garland
Two ways to go about this are here:

Ives, A. R., P. E. Midford, and T. Garland, Jr. 2007. Within-species
variation and measurement error in phylogenetic comparative methods.
Systematic Biology 56:252–270.

Felsenstein, J. 2008. Comparative methods with sampling error and
within-species variation: contrasts revisited and revised. The American
Naturalist 171:713–725.

We have Matlab code for the first one; Joe has code for the second one.
Other can tell you about options in R.

Cheers,
Ted

Theodore Garland, Jr., Distinguished Professor

Department of Evolution, Ecology, and Organismal Biology (EEOB)

University of California, Riverside

Riverside, CA 92521

Office Phone:  (951) 827-3524

Facsimile:  (951) 827-4286 (not confidential)

Email:  tgarl...@ucr.edu

http://www.biology.ucr.edu/people/faculty/Garland.html

http://scholar.google.com/citations?hl=en=iSSbrhwJ


Director, UCR Institute for the Development of
Educational
Applications 


Editor in Chief, *Physiological and Biochemical Zoology
*


Fail Lab: Episode One

*https://www.youtube.com/watch?v=c0msBWyTzU0
*

On Tue, Jul 31, 2018 at 12:04 PM, Nicolay Cunha 
wrote:

> Dear list members,
>
> I would like to test a linear model between a predictor variable (e.g.
> altitude) and a dependent variable (e.g. number of flowers). For this, I do
> have several observations of individuals of 42 species along the predictor
> variable, but the number of observations do vary per each species and class
> of the independent variable. In the end, I do have 364 observations
> unbalanced per each of the 42 species and environment.
>
> My intention is doing a model having the number of flower as dependent
> variable, the temperature as fixed effect, using species as a random factor
> and add a phylogenetic correction. I could do part of this this using GLS,
> but the fact of having multiple observations per species do not allow
> running the model and returns the following message:
>
>
> *“number of observations and number of tips in the tree are not equal.”*
> I would much appreciate if you could give me advices on how to overcome
> this issue and run such model.
>
> Many thanks,
>
> Nicolay
>
> Grupo de Ecología de la Polinización, INIBIOMA,
> CONICET-Universidad Nacional del Comahue,
> Quintral 1250,  8400 San Carlos de Bariloche, Rio Negro, Argentina
>
> #***
> ***#
>
> # Below an example code
>
>
>
>
>
>
> *library(phytools)tree <- rtree(5, rooted = FALSE, tip.label =
> LETTERS[1:5])x <- data.frame(  spp = c(sample(c(LETTERS [1:3]),100,
> replace = T), sample(c(LETTERS [2:4]),100, replace =
> T), sample(c(LETTERS [3:5]),100, replace = T)),
>   alt = rep(c("1000", "1500", "2000"), each = 100),*
>
>
>
> *  flower = rnorm(300)) library(nlme)fit <- gls(flower ~ alt,
> correlation = corPagel(1,tree, fixed=FALSE), method="ML", data = x) *
>
>
> #***
> ***#
>
> [[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-ph...@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] phylogenetic correction for multiple samples per species along an ecological gradient

2018-07-31 Thread Nicolay Cunha
Dear list members,

I would like to test a linear model between a predictor variable (e.g.
altitude) and a dependent variable (e.g. number of flowers). For this, I do
have several observations of individuals of 42 species along the predictor
variable, but the number of observations do vary per each species and class
of the independent variable. In the end, I do have 364 observations
unbalanced per each of the 42 species and environment.

My intention is doing a model having the number of flower as dependent
variable, the temperature as fixed effect, using species as a random factor
and add a phylogenetic correction. I could do part of this this using GLS,
but the fact of having multiple observations per species do not allow
running the model and returns the following message:


*“number of observations and number of tips in the tree are not equal.”*
I would much appreciate if you could give me advices on how to overcome
this issue and run such model.

Many thanks,

Nicolay

Grupo de Ecología de la Polinización, INIBIOMA,
CONICET-Universidad Nacional del Comahue,
Quintral 1250,  8400 San Carlos de Bariloche, Rio Negro, Argentina

#**#

# Below an example code






*library(phytools)tree <- rtree(5, rooted = FALSE, tip.label =
LETTERS[1:5])x <- data.frame(  spp = c(sample(c(LETTERS [1:3]),100,
replace = T), sample(c(LETTERS [2:4]),100, replace =
T), sample(c(LETTERS [3:5]),100, replace = T)),
  alt = rep(c("1000", "1500", "2000"), each = 100),*



*  flower = rnorm(300)) library(nlme)fit <- gls(flower ~ alt,
correlation = corPagel(1,tree, fixed=FALSE), method="ML", data = x) *


#**#

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