Added utilities to convert between estimate values and p-values for an analytic null distribution in bulk (array calls)

This commit is contained in:
jlizier 2017-08-30 16:24:17 +10:00
parent 257ef285d3
commit d36c803e41
1 changed files with 31 additions and 0 deletions

View File

@ -76,6 +76,21 @@ public abstract class AnalyticMeasurementDistribution extends MeasurementDistrib
*/
public abstract double computePValueForGivenEstimate(double estimate);
/**
* Computes p-values corresponding to a set of estimates, each done via
* {@link #computePValueForGivenEstimate(double)}
*
* @param estimates array of estimates to return corresponding p-values for.
* @return
*/
public double[] computePValuesForGivenEstimates(double[] estimates) {
double[] pValues = new double[estimates.length];
for (int i = 0; i < estimates.length; i++) {
pValues[i] = computePValueForGivenEstimate(estimates[i]);
}
return estimates;
}
/**
* Compute the estimated observed measured value corresponding to
* a given p-value
@ -107,9 +122,25 @@ public abstract class AnalyticMeasurementDistribution extends MeasurementDistrib
* Physical Review Letters, <b>109</b>, p. 138105+ (2012).</li>
* </ul>
*
* @param pValue the sample p-value for the given channel measure score under this null hypothesis.
* @return the estimate of the channel measure score corresponding to
* the given p-value under this null hypothesis.
* @throws Exception
*/
public abstract double computeEstimateForGivenPValue(double pValue);
/**
* Computes estimates corresponding to a set of p-values, each done via
* {@link #computeEstimateForGivenPValue(double)}
*
* @param pValues array of p-values to return corresponding estimates for.
* @return
*/
public double[] computeEstimatesForGivenPValues(double[] pValues) {
double[] estimates = new double[pValues.length];
for (int i = 0; i < pValues.length; i++) {
estimates[i] = computeEstimateForGivenPValue(pValues[i]);
}
return estimates;
}
}