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

minor typo in code and checks: `tree_phylm`; `intra_phylm`; `intra_phyglm` #183

Closed paternogbc closed 6 years ago

paternogbc commented 6 years ago

function

tree_phylolm; intra_phylm and intra_phyglm

Problem

Remove unused code and minor bug in checks (is.ultrametric tree)

Reproducible example

1. Remove unused code

#calculate mean and sd for each parameter
  #variation due to tree choice
  mean_by_tree<-stats::aggregate(.~n.tree, data=sensi.estimates, mean) ### remove

  statresults<-data.frame(min=apply(sensi.estimates,2,min),
                          max=apply(sensi.estimates,2,max),
                          mean=apply(sensi.estimates,2,mean),
                          sd_tree=apply(mean_by_tree,2,stats::sd))[-1,] ### fix

Solution

#calculate mean and sd for each parameter
  #variation due to tree choice
  statresults<-data.frame(min=apply(sensi.estimates,2,min),
                          max=apply(sensi.estimates,2,max),
                          mean=apply(sensi.estimates,2,mean),
                          sd_tree=apply(sensi.estimates,2,stats::sd))

2. Fix check

if ( (model == "trend") & (ape::is.ultrametric(phy)))
    stop("Trend is unidentifiable for ultrametric trees., see ?phylolm for details")
  else

Solution

if ( (model == "trend") & (ape::is.ultrametric(phy[[1]])))