わかりました、最初に回帰のデータとして使用したい double のリストがあり、次に観測値をそれぞれの推定値 (標準誤差) と比較します。
しかし、SimpleRegressionを使用すると、2 つのパラメーターが記録されるだけなので (最初と最後だと思います)、標準エラーをチェックしようとすると、OutOfRangeException が発生します。
私は何を間違っていますか?SimpleRegression 以外のものを使用する必要がありますか? RegressionResults 変数にすべての (x,y) ペアの推定値が格納されていないのは奇妙に思えます。
これが私のコードです
//Linear Least Squares method
SimpleRegression regression = new SimpleRegression();
for (int i = 0; i < list.size(); i++) {
regression.addData(i, list.get(i));
}
//I want to see how much a certain max differs from its estimate value.
int indexOfTop = list.indexOf(secondTop);
RegressionResults results = regression.regress();
//How much this calculated top differ from the regression line
double errorOfEstimate = 0;
try {
System.out
.println("Parameters: " + results.getNumberOfParameters());
errorOfEstimate = results.getStdErrorOfEstimate(indexOfTop);
} catch (OutOfRangeException e) {
System.out.println(e);
}