{"id":21919870,"url":"https://github.com/fusion809/gamma-lrt","last_synced_at":"2025-03-22T10:20:25.262Z","repository":{"id":167754358,"uuid":"414835348","full_name":"fusion809/Gamma-LRT","owner":"fusion809","description":"Likelihood-ratio test for samples from gamma-distributed populations. ","archived":false,"fork":false,"pushed_at":"2021-10-11T02:04:52.000Z","size":2148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T10:11:35.506Z","etag":null,"topics":["gamma-distribution","julia-language","likelihood-ratio-test","statistics-in-python"],"latest_commit_sha":null,"homepage":"","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fusion809.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-10-08T03:36:14.000Z","updated_at":"2021-10-11T02:04:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"b837843a-30c8-4b37-bf4a-85584cbbc57c","html_url":"https://github.com/fusion809/Gamma-LRT","commit_stats":null,"previous_names":["fusion809/gamma-lrt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusion809%2FGamma-LRT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusion809%2FGamma-LRT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusion809%2FGamma-LRT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusion809%2FGamma-LRT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fusion809","download_url":"https://codeload.github.com/fusion809/Gamma-LRT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244938801,"owners_count":20535304,"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":["gamma-distribution","julia-language","likelihood-ratio-test","statistics-in-python"],"created_at":"2024-11-28T20:12:05.135Z","updated_at":"2025-03-22T10:20:25.248Z","avatar_url":"https://github.com/fusion809.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Likelihood-ratio test for samples from gamma-distributed populations\nIn this repository, you will find a LaTeX document ([gamma.tex](/gamma.tex)/[gamma.pdf](/gamma.pdf)) in which I derived a likelihood-ratio test for samples from gamma-distributed populations, then using [Julia](/solver.jl) and [Python scripts](/solver.py) tried to apply said test to data I collected in the experimental project of [STA3300 during semester 1, 2021](https://www.usq.edu.au/course/specification/2021/STA3300-S1-2021-ONC-TWMBA.html). I also derived a likelihood-ratio test for samples from exponentially-distributed populations in [exp.tex](/exp.tex), and applied the test in both scripts. \n\nThe Python script failed in its gamma testing mission, due to the limitations of 64-bit arithmetic for this particular problem, as values in excess of 1e7496 are obtained in the calculation. mpmath was tried as a solution to this problem, but mpmath libraries cannot be run on NumPy arrays. \n\nDespite this, a test was performed that assumed exponentially-distributed populations for the data (documented in [exp.tex](/exp.tex)/[exp.pdf](/exp.pdf)), which yielded a p-value of approximately 0.6585 (a result also obtained by the Julia script), which is of course non-significant. This result was not surprising, if our data followed an exponential distribution, we'd expect a lot more paper aeroplanes that were tested to not fly any distance at all. \n\nThe Julia script succeeded in applying the gamma likelihood-ratio test using the BigFloat type, although unfortunately the `chisqcdf` function from StatsFun cannot be run on BigFloat type data, so the test statistic had to be converted to Float64 type before `chisqcdf` was run on it. This yielded a p-value of 0, which makes it likely less than the maximum precision of 64-bit floating-point arithmetic. An attempt to more precisely estimate the p-value was made using the WolframAlpha query: `1-CDF[ChiSquareDistribution[10], 4547]` (decimal ommitted as with the decimal, a result of 0 is given with no alternate form), which gave a result of 0 with an \"Alternate form\" of ![this](https://www5a.wolframalpha.com/Calculate/MSP/MSP160617fbed60g4a53087000048d962a2h9a789f5?MSPStoreType=image/gif\u0026s=15). This was entered into Julia with BigFloat and a result of 5.55e-17 was obtained, so we can be confident our p-value is less than 5.55e-17. \n\nThis p-value is less than the p-value obtained using a gamma generalized linear model on the same data (4.62e-13) and the likelihood-ratio test for samples from normally distributed populations with non-constant variances I derived [here](https://github.com/fusion809/LRT-normal-nonconst-var) (2.12e-9).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusion809%2Fgamma-lrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusion809%2Fgamma-lrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusion809%2Fgamma-lrt/lists"}