-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
Expected: The function below named getZScoreForValue should calculate the Z-Score.
Actual: The implementation is actually the probability density function (PDF) of the normal distribution at a given value
Looking at the code calling the function (and chatting with a colleague who knows more about FastQC's intention here) we came to the conclusion that the function is just misnamed and the behaviour of the code is correct but cant be sure.
If you can let me know either way i'll ensure that the function has the correct name and add unit tests demonstrating its behaviour.
public class NormalDistribution {
private double mean;
private double stdev;
public NormalDistribution (double mean, double stdev) {
this.mean = mean;
this.stdev = stdev;
}
public double getZScoreForValue (double value) {
double lhs = 1d/(Math.sqrt(2*Math.PI*stdev*stdev));
double rhs = Math.pow(Math.E, 0 - (Math.pow(value-mean,2)/(2*stdev*stdev)));
return lhs*rhs;
}
}ChatGPT helped to decipher the issue.

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels