Giter Site home page Giter Site logo

eitanhemed / robusta Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 6.36 MB

Statistical hypothesis testing in Python, using R

Home Page: https://EitanHemed.github.io./robusta

License: GNU General Public License v3.0

Python 99.54% R 0.25% Smarty 0.07% Dockerfile 0.11% Batchfile 0.03% Shell 0.01%

robusta's People

Contributors

eitanhemed avatar tzoofhemed avatar

Stargazers

 avatar

Watchers

 avatar

robusta's Issues

Inferring paired/unpaired t-test from formula

Issue
When fitting a two-samples t-test using the formula interface, it is required to also provide the paired kwarg, although it should be inferred from the formula.

How to reproduce

import robusta as rst
m = rst.groupwise.groupwise_models.T2SamplesModel(data=rst.load_dataset('sleep'), formula='extra~group|ID')
m.fit()

Output
NotImplementedError: Conversion 'py2rpy' not defined for objects of type '<class 'NoneType'>'

Expected Output

Incorrect effect size using groupwise.T2Samples

Issue
Cohen's-d effect size is miscalculated, resulting in larger effect size estimates.

How to reproduce

import robusta as rst
print(rst.groupwise.T2Samples(
    data=rst.load_dataset('sleep'), independent='group', 
    dependent='extra', subject='ID', paired=True, tail='less').report_table().round(2))
t df p-value Cohen-d Low Cohen-d Cohen-d High
-4.062 9.0 0.001 -4.986 -2.708 -0.351

Expected Output
In R:

res = data.frame(tidy(t.test(extra ~ group, data=sleep, paired=T, alternative='less')
res$statistic / sqrt(res$parameter) # d = t / sqrt(N) ~ -1.35

Proposed Solution
The problem arises from rst.groupwise.results.TTestResults, where the usage of psych.t2d to calculate effect size is misguided. We should opt to use the 'n1andn2(degrees of freedom based on each group size) kwargs rather thann` (total degrees of freedom in sample), to get the right values.

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.