SimpleRegression - intercept and tilt calculation errors

I want to implement the Simple Regression model from the apache math library.

I implemented:

//estimate alpha and beta parameters
regression = new SimpleRegression();
for (int l = 0; l < xList.size(); l++) {
    regression.addData(Double.parseDouble(xList.get(l).replace(',', '.')), yList.get(l));
}

//add alpha
regression.getIntercept();

//add beta
regression.getSlope();

//add R^2
regression.getRSquare();

Compared to a simple google spreadsheet to check my results:

I get completely different results. Here you can also see the image:

enter image description here

Would I appreciate any recommendations to resolve this issue?

UPDATE

I know that statistically these data are not valuable (for example, see R^2). However, I want to find out what is wrong with the calculation, and not with some statistical properties!

I use:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <version>3.0</version>
</dependency>

I appreciate every idea!

+4
2

: 0,85% 0,0085. , , X Y .

0

R^2 alfa beta, . . , , - , . R^2 0,5%, , , , , . , , - . Excel ( ).

0

Source: https://habr.com/ru/post/1525302/


All Articles