{"id":17951916,"url":"https://github.com/tpaschalis/xicor-go","last_synced_at":"2025-04-03T16:21:19.942Z","repository":{"id":57647952,"uuid":"442114191","full_name":"tpaschalis/xicor-go","owner":"tpaschalis","description":"A Go implementation of Chatterjee's Xi correlation coefficient","archived":false,"fork":false,"pushed_at":"2022-01-03T14:56:51.000Z","size":41,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-09T04:45:48.185Z","etag":null,"topics":["go","math","statistics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpaschalis.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}},"created_at":"2021-12-27T09:34:11.000Z","updated_at":"2025-01-03T05:09:48.000Z","dependencies_parsed_at":"2022-08-25T08:23:01.988Z","dependency_job_id":null,"html_url":"https://github.com/tpaschalis/xicor-go","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/tpaschalis%2Fxicor-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaschalis%2Fxicor-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaschalis%2Fxicor-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpaschalis%2Fxicor-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpaschalis","download_url":"https://codeload.github.com/tpaschalis/xicor-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247033817,"owners_count":20872533,"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":["go","math","statistics"],"created_at":"2024-10-29T09:51:42.029Z","updated_at":"2025-04-03T16:21:19.919Z","avatar_url":"https://github.com/tpaschalis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xicor-go\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## What is xicor?\n`xicor-go` is a Go implementation of the \"xi\" correlation metric described in the paper [_\"A new coefficient of correlation\"_](https://arxiv.org/pdf/1909.10140.pdf) by Sourav Chatterjee (arxiv.org/abs/1909.10140).\n\nThe current implementation is based off the [R code](https://statweb.stanford.edu/~souravc/xi.R) mentioned in the paper, and influenced by a [Python port](https://github.com/czbiohub/xicor) by [czbiohub](https://github.com/czbiohub/xicor). There is also a [mirror](https://github.com/cran/XICOR) of the CRAN R package hosted on GitHub.\n\nThe package provides the `Xi` struct which receives the input data along with a number of functional options and is used to calculate the correlation coefficient and p-value.\n\nFor a graphical comparison between the standard linear correlation coefficient and the Xi \"rank correlation\", you can refer to [this](https://twitter.com/adad8m/status/1474754752193830912) excellent tweet by [adad8m](https://twitter.com/adad8m)\n\n\u003c!--\nThere is also a dev branch which utilizes [Go generics](https://go.dev/doc/tutorial/generics) introduced in Go 1.18, which will be merged into the canonical release once Go 1.18 is released in February.\n--\u003e\n\n## Installation\nFor a project utilizing Go modules, all you need to do is\n```\ngo get github.com/tpaschalis/xicor-go\n```\n\n## Usage\n\n```go\nimport \"github.com/tpaschalis/xicor-go\"\n\nfunc main() {\n\tx := []float64{0, 1, 2, 3, 4}\n\ty := []float64{5, 6, 7, 8, 9}\n\n\t// Create a new Xi object and get the correlation\n\txi, err := xicor.New(x, y).Correlation()\n\n\t// Create a new Xi object and obtain the correlation along with its p-value\n\t// Use functional options to define how to perform the calculation\n\txi, pvalue, err := xicor.New(\n\t\tx,\n\t\ty,\n\t\txicor.WithPermutationPvalue(1000),\n\t\txicor.WithoutTies(),\n\t).Pvalue()\n\n\t// You can also use the Xi object directly\n\tdata := \u0026xicor.Xi{\n\t\tX:          x,\n\t\tY:          y,\n\t\tWantPvalue: true,\n\t\tMethod:     \"asymptotic\",\n\t\tDataTies:   true,\n\t}\n\n\txi, pvalue, err = data.Pvalue()\n\tfmt.Println(xi, pvalue, err)\n}\n```\n\n## Current status\nI'm working towards a more stable and performant v0.0.1 release; the focus is on:\n- Validating correctness of results by comparing against original R code (current tests haven't produced any inconsistency yet)\n- Add support for categorical variables (a la the `factor` function used in R)\n- Use dev branch to rewrite some of the code using Go 1.18 generics\n- Run through a profiler to find and eliminate bottlenecks\n\n## Benchmarks\nThe current pre-v0.0.1 version of the code runs through 100k randomized samples in about 0.12 seconds.\n\nWhile there's a lot of low-hanging fruit to improve performance, I'll get to it once v0.0.1 is near.\n\n## Contributing\nIf you have an idea, or would like to discuss and contribute an improvement, you can reach out in the repo [Issues](https://github.com/tpaschalis/xicor-go/issues) and open a [Pull Request](https://github.com/tpaschalis/xicor-go/pulls)\n\n## License\nThis code in this repo is licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpaschalis%2Fxicor-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpaschalis%2Fxicor-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpaschalis%2Fxicor-go/lists"}