Giter Club home page Giter Club logo

pari's People

Contributors

angeella avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pari's Issues

Bug in permTest

Hi Angela,

There seems to be an important bug in your calculation of two-sample Welch statistics: the test statistics you report are inconsistent (and much larger) than the ones obtained by t.test. See the example below with m=2 tests using n=100 observations, with no signal.

> n <- 100
> m <- 2
> groups <- rep(c(0, 1), each = n/2)
> 
> mat <- matrix(rnorm(m*n), m, n) 
> t.test(mat[1, ]~groups)

	Welch Two Sample t-test

data:  mat[1, ] by groups
t = 1.4507, df = 92.122, p-value = 0.1503
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -0.1055058  0.6772781
sample estimates:
mean in group 0 mean in group 1 
      0.1640547      -0.1218315 

> out <- pARI::permTest(X = mat, label = groups, B = 10, rand = FALSE)
> out$pv
[1] 1.239105e-10 3.401634e-01
> out$Test
[1] 7.2533998 0.9592307

In order to spot this type of errors, I highly recommend testing your code, see https://r-pkgs.org/tests.html.

In this case a minimal test is to ensure that your function reproduces the results of stats::t.test. This is what we do in the sansSouci package, see e.g. https://github.com/pneuvial/sanssouci/blob/develop/tests/testthat/test_rowWelchTests.R

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.