-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression equation #3301
Comments
No, I'm afraid. It will work only on regularly spaced data items. We'll need to update the docs. Sorry for the confusion. |
Hi Ok it's not a real problem :) Do you think that in the future you will implement this kind of regression ? I think it will be more usefull that the "regression" that is allready implemented Thanks for the answer. |
There's no plan for that, but who knows :) I'm gonna leave this open for now. |
I've also been looking for the ability to add trend lines to a scatter / bubble chart with multiple series |
If anyone (maybe @ChazUK) is interested in a simple solution I used import SimpleLinearRegression from 'ml-regression-simple-linear';
// ...
if (graphData.length > 1) {
const x = graphData.map(({ x }) => x);
const y = graphData.map(({ y }) => y);
const regression = new SimpleLinearRegression(x, y);
var fixedLinearRegression = chart.series.push(new am4charts.LineSeries());
fixedLinearRegression.data = [
{ x: x[0], y: regression.predict(x[0]) },
{ x: x[x.length - 1], y: regression.predict(x[x.length - 1]) },
];
fixedLinearRegression.dataFields.valueX = "x";
fixedLinearRegression.dataFields.valueY = "y";
fixedLinearRegression.strokeWidth = 2;
fixedLinearRegression.stroke = am4core.color("#ff6860");
fixedLinearRegression.name = "Linear Regression";
} |
Hi
I got a question about the regression plugin.
With a very simple graph i don't understand the equation result.
The result of the equation is strange for me.
I expect to get this result :
In debugging the result i found that the point are strange :
It appears to me that the x value is ignored and replace by the index of the array which doesn't make sense to me.
In the docs there is this sentence :
Do you handle correctly a regression with two value axis or not?
The text was updated successfully, but these errors were encountered: