paternogbc / sensiPhy

R package to perform sensitivity analysis for comparative methods
http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12990/full
GNU General Public License v2.0
12 stars 4 forks source link

intra_physig problem with se argument #182

Closed caterinap closed 6 years ago

caterinap commented 6 years ago

phytools::phylosig has already the possibility to include intraspecific variation/error using the method from Ives et al. (2007). If people decide to try to use both Ives method and "our method", the function does not work. This is because when you specify the error argument in phylosig (se), the output from phylosig is different.

For now the fastest would be to just add this information in the help (i.e. that one cannot use both things) but in future we might want to solve this problem by throwing an error.

Also, I just noticed that we should remove the following from the help:

Currently, this function can only implement simple linear models (i.e. \eqn{trait~ predictor}). In the future we will implement more complex models.

And change title which is:

Intraspecific variability - Phylogenetic Linear Regression

We should also check if this appears in other phylo signal functions.

The code, if you want to see what happens:

library(sensiPhy)
library(phytools)
data(alien)
intra <- intra_physig(trait.col = "gestaLen", V = "SD_gesta" , data = alien.data, phy = alien.phy[[1]],n.intra=4,se="SD_gesta)

tree<-pbtree(n=100)
x<-fastBM(tree)
y <- x/2
phylosig(tree,x,method="lambda",test=TRUE)
phylosig(tree,x,method="lambda",test=TRUE,se=y) #this is Ives method
paternogbc commented 6 years ago

Great I will be on it 👊

On Tue, 16 Jan 2018 at 20:28 Caterina Penone notifications@github.com wrote:

phytools::phylosig has already the possibility to include intraspecific variation/error using the method from Ives et al. (2007). If people decide to try to use both Ives method and "our method", the function does not work. This is because when you specify the error argument in phylosig (se), the output from phylosig is different.

For now the fastest would be to just add this information in the help (i.e. that one cannot use both things) but in future we might want to solve this problem by throwing an error.

Also, I just noticed that we should remove the following from the help:

Currently, this function can only implement simple linear models (i.e. \eqn{trait~ predictor}). In the future we will implement more complex models.

We should also check if this appears in other phylo signal functions.

The code, if you want to see what happens:

library(sensiPhy) library(phytools) data(alien) intra <- intra_physig(trait.col = "gestaLen", V = "SD_gesta" , data = alien.data, phy = alien.phy[[1]],n.intra=4,se="SD_gesta)

tree<-pbtree(n=100) x<-fastBM(tree) y <- x/2 phylosig(tree,x,method="lambda",test=TRUE) phylosig(tree,x,method="lambda",test=TRUE,se=y) #this is Ives method

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paternogbc/sensiPhy/issues/182, or mute the thread https://github.com/notifications/unsubscribe-auth/AJMWOT_jzvSleuELUV4G_fMffHtiPSENks5tLGvIgaJpZM4RfeQl .

--

Gustavo Brant Paterno Doutorando em Ecologia Departamento de Ecologia Universidade Federal do Rio Grande do Norte

email : paternogbc@gmail.com Google Citations: https://scholar.google.com/citations?user=uNxyHMkAAAAJ&hl=pt-BR https://scholar.google.com/citations?user=uNxyHMkAAAAJ&hl=pt-BR Research Gate: https://www.researchgate.net/profile/Gustavo_Paterno2 https://www.researchgate.net/profile/Gustavo_Paterno2 Github: https://github.com/paternogbc Blog : www.Raprendiz.wordpress.com Skype : gustavopaterno Lattes: http://lattes.cnpq.br/3661227833522004

caterinap commented 6 years ago

Just checked, the sentence about linear models in documentation does not appear in other phylosig functions.

paternogbc commented 6 years ago

Hey guys,

have excluded these sentences and fixed the issue of "se" by simply removing the "..." further argument being passed from 'intra_physig' to 'phylosig'.

intra_physig <- function(trait.col, data, phy,
                        V = NULL, n.intra = 100, distrib = "normal",
                        method = "K", track = TRUE){

Now the following code gives an error (unused argument).

library(sensiPhy)
library(phytools)
data(alien)
intra <- intra_physig(trait.col = "gestaLen", V = "SD_gesta" , 
                      data = alien.data, phy = alien.phy[[1]],n.intra=4, se = "SD_gesta")
Error in intra_physig(trait.col = "gestaLen", V = "SD_gesta", data = alien.data,  : 
  unused argument (se = "SD_gesta")
paternogbc commented 6 years ago

Perhaps we skip the "..." and include all important arguments directly in our functions. (maybe implement in all sensiPhy functions).