Skip to content
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

regressionExponential and regressionPower break for negative y values #11

Open
toja opened this issue Apr 14, 2019 · 2 comments
Open

regressionExponential and regressionPower break for negative y values #11

toja opened this issue Apr 14, 2019 · 2 comments

Comments

@toja
Copy link

toja commented Apr 14, 2019

Probably because of Math.log(dy) that will return NaN

@antonsegerkvist
Copy link

Hello @toja

That is correct.

The exponential regression formula looks like ln(y) = ln(a) + b * x and hence does not support negative y values.

The power regression formula looks like ln(y) = ln(a) + b * ln(x) and hence does not support neither negative x or y values.

You can circumvent the issue by filtering your points.

The question then becomes if this should be left to application level to be handled, or if the library should handle it?

BR Anton

@dbratell
Copy link

The documentation for regressionExp says ignoring points with invalid values (null, undefined, NaN, Infinity). so ignoring negative values would also be ok. Not that the documentation seems to be true because at least null also results in a NaN output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants