MyNixOS website logo
Description

Multi-Trait Dissimilarity with more Uniform Contributions.

R function gawdis() produces multi-trait dissimilarity with more uniform contributions of different traits. de Bello et al. (2021) <doi:10.1111/2041-210X.13537> presented the approach based on minimizing the differences in the correlation between the dissimilarity of each trait, or groups of traits, and the multi-trait dissimilarity. This is done using either an analytic or a numerical solution, both available in the function.

gawdis

gawdis is was designed in the manuscript Towards a more balanced combination of multiple traits when computing functional differences between species by Francesco de Bello, Zoltan Botta-Dukat, Jan Leps & Pavel Fibich (2021) Methods in Ecology and Evolution 12: 443-448. doi: 10.1111/2041-210X.13537.

gawdis R package provides 'gawdis()' function to produce multi-trait dissimilarity with more uniform contributions of different traits. The approach is based on minimizing the differences in the correlation between the dissimilarity of each trait, or groups of traits, and the multi-trait dissimilarity. This is done using either an analytic or a numerical solution, both available in the function.

gawdis is available on CRAN https://cran.r-project.org/web/packages/gawdis/ you just need to

install.packages("gawdis")
library("gawdis")

and then run it similarly as 'gowdis()' from FD package ( https://cran.r-project.org/web/packages/FD/ ).

Examples

For nice examples see vignettes on CRAN https://cran.r-project.org/web/packages/gawdis/ or directly in R :

  vignette("gawdis")

To check the package, you can also follow additional examples:

  library(gawdis)
  bodysize<-c(10, 20, 30, 40, 50, NA, 70)
  carnivory<-c(1, 1, 0, 1, 0,1, 0)
  red<-c(1, 0, 0.5, 0, 0.2, 0, 1)
  yellow<-c(0, 1, 0, 0, 0.3, 1, 0)
  blue<-c(0, 0, 0.5,1, 0.5, 0, 0)
  colors.fuzzy<-cbind(red, yellow, blue)
  names(bodysize)<-paste("sp", 1:7, sep="")
  names(carnivory)<-paste("sp", 1:7, sep="")
  rownames(colors.fuzzy)<-paste("sp", 1:7, sep="")
  tall<-as.data.frame(cbind(bodysize, carnivory, colors.fuzzy))
  
  dissim.bodysize<-gowdis(tall[, "bodysize", drop=F])
  dissim.carnivory<-gowdis(tall[, "carnivory", drop=F])
  dissim.colour<-gowdis(tall[, 3:5])/max(gowdis(tall[, 3:5]))
  dissim.bodysize
  dissim.carnivory
  dissim.colour
  
  dall<-list(as.matrix(dissim.bodysize), as.matrix(dissim.carnivory), as.matrix(dissim.colour))
  mean.dissim.all<-as.dist(apply(simplify2array(dall), c(1, 2), mean, na.rm=T), 2)
  mean.dissim.all### this is the correct one
  
  
  (gaw.tallo<-gawdis(tall, w.type="optimized", groups =c(1, 2, 3,3,3), fuzzy=c(3) ) )
  (gaw.talle<-gawdis(tall, w.type="equal", groups =c(1, 2, 3, 3, 3), fuzzy=c(3) ) )
  attr(gaw.talle,"weights")
  
  #make groups, when there are traits that are either very much correlated
  #or from the same organs#
  #example from the tussock dataset, with many leaf traits#
  library("FD")
  head(tussock$trait)
  head(tussock$trait[, 3:7])
  cor(tussock$trait[, 3:7], use = "complete")
  #select fewer traits and log-transform when needed#
  tussock.trait<-tussock$trait[, c("height", "LDMC", "leafN","leafS",
  "leafP", "SLA", "seedmass", "raunkiaer", "pollination", "clonality",
  "growthform")]
  tussock.trait.log<-tussock.trait
  #some traits needed log-tranformation, just creating a matrix to
  #store the new data
  tussock.trait.log$height<-log(tussock.trait$height)
  tussock.trait.log$seedmass<-log(tussock.trait$seedmass)
  tussock.trait.log$leafS<-log(tussock.trait$leafS)
  colnames(tussock.trait.log)
  #run the function and test trait contributions#
  #there are NAs so the iteration approach is the only possible#
  #only 20 iterations are used, because of tests#
  #use definitely at least opti.maxiter=100
  gaw.groups<-gawdis(tussock.trait.log, w.type = "optimized",
  opti.maxiter=20,groups.weight=TRUE,groups = c(1,2,2,2,2,2,3,4,5,6,7))
  cors.gaw.gr<-attr(gaw.groups,"correls")
  cors.gaw.gr[12]<-attr(gaw.groups,"group.correls")[2]
  names(cors.gaw.gr)[12]<-"leaves"
  cors.gaw.gr
  #correlation of single traits dissimilarity,
  #including all leaf traits together ("leaves") with
  #multi-trait dissimilarity

  
Metadata

Version

0.1.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows