Skip to content

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

Notifications You must be signed in to change notification settings

fusion809/Gamma-LRT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Likelihood-ratio test for samples from gamma-distributed populations

In this repository, you will find a LaTeX document (gamma.tex/gamma.pdf) in which I derived a likelihood-ratio test for samples from gamma-distributed populations, then using Julia and Python scripts tried to apply said test to data I collected in the experimental project of STA3300 during semester 1, 2021. I also derived a likelihood-ratio test for samples from exponentially-distributed populations in 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.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. 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 (2.12e-9).

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published