haskell / statistics

A fast, high quality library for computing with statistics in Haskell.
http://hackage.haskell.org/package/statistics
BSD 2-Clause "Simplified" License
300 stars 68 forks source link

Documentation: example(s) of simple cases of linear regression #171

Open crosser opened 4 years ago

crosser commented 4 years ago

As a non-statistician, I need to run linear regression on a set of data points, such as:

measurements = [(1.0, 2.0), (2.0, 2.5), (3.0, 3.0)} :: [(Double, Double)]  -- (X, Y) coordinates of points

and get a = 1.5 and b = 0.5 from the fromula

y = a + bx

While the function for the least squares algorithm exists (Statistics.Regression.ols, apparently), it is not clear for a non-statistician how to convert the data to the arguments of the ols function and how to interpret the results.

It would be helpful to have examples in the documentation for such common and simple use cases for ols (and maybe other common functions) to make it approachable for people without (much) background in statistics.