本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.TOO_MANY_REGRESSORS属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.TOO_MANY_REGRESSORS属性的具体用法?Java LocalizedFormats.TOO_MANY_REGRESSORS怎么用?Java LocalizedFormats.TOO_MANY_REGRESSORS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.TOO_MANY_REGRESSORS属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: regcf
/**
* The regcf method conducts the linear regression and extracts the
* parameter vector. Notice that the algorithm can do subset regression
* with no alteration.
*
* @param nreq how many of the regressors to include (either in canonical
* order, or in the current reordered state)
* @return an array with the estimated slope coefficients
* @throws ModelSpecificationException if {@code nreq} is less than 1
* or greater than the number of independent variables
*/
private double[] regcf(int nreq) throws ModelSpecificationException {
int nextr;
if (nreq < 1) {
throw new ModelSpecificationException(LocalizedFormats.NO_REGRESSORS);
}
if (nreq > this.nvars) {
throw new ModelSpecificationException(
LocalizedFormats.TOO_MANY_REGRESSORS, nreq, this.nvars);
}
if (!this.tol_set) {
tolset();
}
final double[] ret = new double[nreq];
boolean rankProblem = false;
for (int i = nreq - 1; i > -1; i--) {
if (FastMath.sqrt(d[i]) < tol[i]) {
ret[i] = 0.0;
d[i] = 0.0;
rankProblem = true;
} else {
ret[i] = rhs[i];
nextr = i * (nvars + nvars - i - 1) / 2;
for (int j = i + 1; j < nreq; j++) {
ret[i] = smartAdd(ret[i], -r[nextr] * ret[j]);
++nextr;
}
}
}
if (rankProblem) {
for (int i = 0; i < nreq; i++) {
if (this.lindep[i]) {
ret[i] = Double.NaN;
}
}
}
return ret;
}