final ContinuousDistribution studentT = new TDistributionImpl(n - k);
for (int i = 0; i < k; i++) {
standardErrorsOfBeta[i] = Math.sqrt(meanSquareError * covarianceBetas[i][i]);
tStats[i] = betas[i] / standardErrorsOfBeta[i];
try {
pValues[i] = 1 - studentT.cumulativeProbability(Math.abs(tStats[i]));
} catch (final org.apache.commons.math.MathException e) {
throw new com.opengamma.analytics.math.MathException(e);
}
}
return new WeightedLeastSquaresRegressionResult(betas, residuals, meanSquareError, standardErrorsOfBeta, rSquared, adjustedRSquared, tStats, pValues,