An open API service indexing awesome lists of open source software.

https://github.com/fusion809/gamma-lrt

Likelihood-ratio test for samples from gamma-distributed populations.
https://github.com/fusion809/gamma-lrt

gamma-distribution julia-language likelihood-ratio-test statistics-in-python

Last synced: about 1 year ago
JSON representation

Likelihood-ratio test for samples from gamma-distributed populations.

Awesome Lists containing this project

README

          

# Likelihood-ratio test for samples from gamma-distributed populations
In 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.

The 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.

Despite 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.

The 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&s=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.

This 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).