jxxcarlson/elm-stat/1.0.3

NOTE: the latest version is 6.0.3

Stat

The aim of this library is to compute statistics for 2D data.

type alias Data =
List Point

The fundamental data structure: a list of points.

type alias Point =
{ x : Float
, y : Float
}

A point in the Cartesian plane given by x and y coordinates

type alias Statistics =
{ m : Float
, b : Float
, n : Int
, r2 : Float
, xMin : Float
, xMax : Float
, xMean : Float
, yMean : Float
, xStdev : Float
, yStdev : Float
, leftDataPoint : Point
, rightDataPoint : Point
, leftRegressionPoint : Point
, rightRegressionPoint : Point
}

A Statistics value holds information like the mean and standard deviation of the x and y values of Data value (list of points), as well as the coefficients m and b of the regression line, the R^2 value, etc. Compute using statistics data.

average : (data -> Float) -> List data -> Maybe Float

Compute the average of a column in a list of data, e.g.,

```average .x data```

which computes the average of the x-values.

filterData : Filter -> Data -> Data

Apply filters to the data, This is set up as a pipeline so that other filters can be added later. We may have to go with different architectue if we have may filters -- best to avoid too many repeated list traversals.

maximum : (data -> Float) -> List data -> Maybe Float

Compute the maximum of a column in a list of data, e.g.,

```maximum .x data```

which computes the maximum of the x-values.

minimum : (data -> Float) -> List data -> Maybe Float

Compute the minimum of a column in a list of data, e.g.,

```minimum .x data```

which computes the minimum of the x-values.

statistics : Data -> Maybe Statistics

Compute the statistics of a Data value.

stdev : (data -> Float) -> List data -> Maybe Float

Compute the standard deviation of a column in a list of data, e.g.,

```stdev .x data```

which computes the standard deviation of the x-values.