title: Weighted Linear Regression in Java
body: <p>Does anyone know of a scientific/mathematical library in Java that has a straightforward implementation of weighted linear regression? Something along the lines of a function that takes 3 arguments and returns the corresponding coefficients:</p>
  
  <pre><code>linearRegression(x,y,weights)
  </code></pre>
  
  <p>This seems fairly straightforward, so I imagine it exists somewhere.</p>
  
  <p>PS) I've tried Flannigan's library: <a href="http://www.ee.ucl.ac.uk/~mflanaga/java/Regression.html" rel="noreferrer">http://www.ee.ucl.ac.uk/~mflanaga/java/Regression.html</a>, it has the right idea but seems to crash sporadically and complain out my degrees of freedom?</p>