Simple linear regression with JavaScript