-2

I am trying to get the slope for the best first line:

SimpleRegression simpleRegression = new SimpleRegression();
simpleRegression.addData(...);
...

simpleRegression.getSlope()
simpleRegression.getIntercept()

I am trying to get it to force through zero though so the formula can be reduced down to y=mx

How should I go about this?

Tim Nuwin
  • 2,775
  • 2
  • 29
  • 63
  • I think this question might be useful for people who type in google: "finding least squares regression and force through 0 intercept in java" as most questions w/ this problem are done via R. – Tim Nuwin Jan 08 '19 at 16:29

1 Answers1

-1

Looks like the constructor takes a true/false argument for intercept.

For my use case of not having an intercept I would have to declare: new SimpleRegression(false)

Tim Nuwin
  • 2,775
  • 2
  • 29
  • 63