-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normality test #482
Comments
Hi @8ctopus, Thank you for your interest in MathPHP. We have the χ² (chi-squared) test in I think it is a good feature to add. The Wikipedia article lists many tests. If you had to pick only one to implement, which one would be the most useful to have implemented? Thanks again for your suggestions and feedback. |
@markrogoyski Hello Mark, I have used the chi-squared test before in medical statistics and it works great provided the data is normally distributed (if not you can't use it as you already know). So far, I have roughly tested normality two ways:
/**
* Approximate normality test
*
* @param array $data
*
* @return float - percentage
*
* @note found here https://www.paulstephenborile.com/2018/03/code-benchmarks-can-measure-fast-software-make-faster/
*/
public static function testNormality(array $data) : float
{
$mean = self::mean($data);
$median = self::median($data);
return abs($mean - $median) / max($mean, $median);
} Both approaches are empirical and therefore I don't think they fit into your library. Going back to the Wikipedia article, it says:
So my best guess, as I have no experience, would be the |
First of all thank you for this amazing library! Also I want to apologize if I overlooked something as I'm not a math genius.
I'm wondering if there is any implementation of normality tests yet?
The idea is that considering a bunch of data, for example, the height of students in a college, is to check whether the data follows a normal distribution (Gaussian curve).
The text was updated successfully, but these errors were encountered: