Giter Club home page Giter Club logo

paleotools's Introduction

paleotools

The goal of paleotools is to …

Installation

You can install the development version of the package from GitHub with:

# install.packages("devtools")
devtools::install_github("mchevalier2/paleotools")

Example

This is a basic example which shows you how to use the Earth Movers’ Distance (EMD) and the associated significance test.

library(paleotools)

EMD(1:5/sum(1:5), 6:10/sum(6:10))
#> [1] 0.125
EMD(1:5, 6:10) # The vectors are normalised by the function
#> [1] 0.125
m <- matrix(1:25, ncol=5)
for(i in 1:5) m[i,i] <- 0
EMD(1:5, 6:10, weight.m=m)
#> [1] 0.03298612
m1 <- matrix(abs(rnorm(500)), ncol=5) ; m1 <- m1 / apply(m1, 1, sum)
m2 <- matrix(abs(rnorm(500)), ncol=5) ; m2 <- m2 / apply(m2, 1, sum)
EMD.test(m1, m2, plot=FALSE)
#> 
#>  Testing significativity of the EMD
#> 
#> Measured EMD: 0.382 
#> Uncertainty range:   Max    99%     95%     90%
#>                    0.415      0.41    0.402   0.4 
#> Randomised data:     Min     1%      5%     10%
#>                    0.345      0.355   0.36    0.362 
#> pvalue = 0.61
res <- EMD.test(m1, m2, plot=TRUE, verbose=TRUE)
#> 
#>  Testing significativity of the EMD
#> 
#> Measured EMD: 0.382 
#> Uncertainty range:   Max    99%     95%     90%
#>                    0.413      0.406   0.4     0.396 
#> Randomised data:     Min     1%      5%     10%
#>                    0.35   0.353   0.362   0.364 
#> pvalue = 0.585
res <- EMD.test(m1, 1+m1, plot=TRUE, verbose=TRUE, nrep=100)
#> 
#>  Testing significativity of the EMD
#> 
#> Measured EMD: 0.225 
#> Uncertainty range:   Max    99%     95%     90%
#>                    0.242      0.24    0.239   0.234 
#> Randomised data:     Min     1%      5%     10%
#>                    0.267      0.268   0.269   0.269 
#> pvalue < 0.01
str(res)
#> List of 4
#>  $ target      : num 0.225
#>  $ pvalue      : num 0
#>  $ randomised  : num [1:100] 0.273 0.273 0.277 0.27 0.271 ...
#>  $ bootstrapped: num [1:100] 0.235 0.223 0.223 0.231 0.239 ...

paleotools's People

Contributors

mchevalier2 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.