{"id":17646998,"url":"https://github.com/bencardoen/logparadox.jl","last_synced_at":"2025-03-30T08:40:59.814Z","repository":{"id":77438548,"uuid":"584879917","full_name":"bencardoen/LogParadox.jl","owner":"bencardoen","description":"Detects sufficient and necessary conditions for pattern inversion conditional on log transform","archived":false,"fork":false,"pushed_at":"2024-12-20T15:53:44.000Z","size":1393,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T10:48:47.481Z","etag":null,"topics":["confounding","hypothesis-testing","julia","log-transformation","pattern-inversion"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bencardoen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-03T18:52:06.000Z","updated_at":"2024-12-20T15:53:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"394ed18f-8793-4cd0-96bf-e0f31edcd369","html_url":"https://github.com/bencardoen/LogParadox.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencardoen%2FLogParadox.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencardoen%2FLogParadox.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencardoen%2FLogParadox.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencardoen%2FLogParadox.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencardoen","download_url":"https://codeload.github.com/bencardoen/LogParadox.jl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246296583,"owners_count":20754632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["confounding","hypothesis-testing","julia","log-transformation","pattern-inversion"],"created_at":"2024-10-23T11:09:27.264Z","updated_at":"2025-03-30T08:40:59.612Z","avatar_url":"https://github.com/bencardoen.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LogParadox\n\nA project to illustrate how you can obtain paradoxical pattern inversions when applying hypothesis tests, conditional on a log transform of your data.\n\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7545842.svg)](https://doi.org/10.5281/zenodo.7545842)\n\n\n[![Coverage](https://codecov.io/gh/bencardoen/LogParadox.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/bencardoen/LogParadox.jl)\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/bencardoen/LogParadox.jl/tree/main.svg?style=svg\u0026circle-token=304e0f4d40f0fdb0363572f8fabf8ee73334ebfd)](https://dl.circleci.com/status-badge/redirect/gh/bencardoen/LogParadox.jl/tree/main)\n\n## Motivating Minimal Reproducible Example\nSuppose you're comparing two vectors of data, X, and Y. This example shows we can find Y such that\n* E[X] \u003e E[Y],\nyet\n* E[log(X)] \u003c  E[log(Y)].\n\nIn other words, there exist distributions, especially in long tail data, where **small** differences between the 2 datasets can induce a 'X is greater than Y' conclusion, yet in log scale, report a 'X is smaller than Y' conclusion.\nWe show that you can get this effect with X differing from Y in as little as 5%.\nIn the image below X is in blue, and we find Y by replacing a small percentage of X.\n\nThe necessary and sufficient conditions are derived in the paper, but our API allows you to test to see if you data is vulnerable or not, and when.\n\n\n![example](figures/interactivelp.gif)\n\n### Effect on significance testing\nUsing a non-parametric hypothesis test, at 5% of data modified, you can induce a strong inversion effect consistently achieving significance.\n\nNote that this does not try to reinforce the flawed idea that significance in isolation is sufficient to publish, rather serve as a cautionary tale that inducing significant inversions is fairly easily accomplished.\n\nIn the below figure we compare X and Y, where Y is obtained by iteratively replacing elements in X.\nWe report the significance (p-value) of the Mann Whitney U-test (Y-axis, log scale), with the three common reference values plotted as horizontal lines.\nAs you can observe, a x=25, both geometric and arithmetic means are changed at α=0.001 (pink), and this effect only becomes stronger as the number of replacements increases.\n\n![example](figures/pvals50_200.png)\n\n### Sensitivity of symmetric distributions\nWhen we induce left and right long tails on a symmetric distribution, the preconditions for the paradox (ID[X] --\u003e +∞) are still present, showing that LP is not restricted to right long tail distributions.\n\n![example](figures/symmetry.png)\n\n## Installation\n- Get [Julia](https://julialang.org/learning/getting-started/)\n```bash\njulia\njulia 1.x\u003eusing Pkg; Pkg.add(url=\"https://github.com/bencardoen/ERGO.jl.git\")\njulia 1.x\u003eusing Pkg; Pkg.add(url=\"https://github.com/bencardoen/SPECHT.jl.git\")\njulia 1.x\u003eusing Pkg; Pkg.add(url=\"https://github.com/bencardoen/LogParadox.jl.git\")\njulia 1.x\u003ePkg.test(\"LogParadox\")\njulia 1.x\u003eusing LogParadox\n```\n\n## Usage\n\nSee [scripts](https://github.com/bencardoen/LogParadox.jl/tree/main/scripts) for example illustrations that use the API.\n\nAn example using in silico 2D image data, inspired by real datasets is found [here](https://github.com/bencardoen/LogParadox.jl/tree/main/scripts/markov.jl).\n\nThe script that generates the gif in this readme is found [here](https://github.com/bencardoen/LogParadox.jl/tree/main/scripts/gif.jl), and illustrates how the paradoxical comparison can be induced.\n\nAn example of inducing the paradox in combination with hypothesis testing is found [here](https://github.com/bencardoen/LogParadox.jl/blob/main/scripts/mwu.jl).\n\nCode for the a plot that shows you the effect of symmetric tails can be found here [here](https://github.com/bencardoen/LogParadox.jl/blob/main/scripts/mesh.jl).\n\nHere we plot what happens to the intermean distance `d(m, M)` in function of m(inimum) and M(aximum).\n![fig](figures/mesh.svg)\n\n\n### Minimal example with API\n```julia\nusing LogParadox, Distributions\nRandom.seed!(42)\nxs = randexp(1000)*1000 .+ 10\nys = transform_steps_replace(xs, 100)\n@assert gm(xs) \u003c gm(ys) \u003c am(ys) \u003c am(xs)\n```\nThe `gm` and `am` functions compute the geometric and arithmetic mean, the transform function iteratively changes the input array `xs` to induce the paradox.\nAll functions in the module have docstring, so to access these you can do in a julia REPL:\n```julia\nusing LogParadox\n?transform_steps_replace\n```\nwhich would look something like this\n\n![docstring](figures/docs.png)\n\n## Troubleshooting\nIf you have any comments, issues, problems, or suggestions, please create an issue with reproducible description of the problem at hand.\n\n## Cite\n```bibtex\n@software{ben_cardoen_2023_7545842,\n  author       = {Ben Cardoen and\n                  Hanene Ben Yedder and\n                  Sieun Lee and\n                  Ivan Robert Nabi and\n                  Ghassan Hamarneh},\n  title        = {LogParadox},\n  month        = jan,\n  year         = 2023,\n  publisher    = {Zenodo},\n  doi          = {10.5281/zenodo.7545842},\n  url          = {https://doi.org/10.5281/zenodo.7545842}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencardoen%2Flogparadox.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencardoen%2Flogparadox.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencardoen%2Flogparadox.jl/lists"}