jxxcarlson/elm-stat/3.0.0

NOTE: the latest version is 6.0.3

ErrorBars

The ErrorBars module provides functions for drawing graphs with errors bars. Suppose that we have dome data:

> data = SampleData.eb2 |> Data.fromString 0 1

Then

> ErrorBars.mean data

produces a list of ponts that pass through the mean valjues of data points with given x value. For error bars with extreme ponts one standard deviatoin from the mean, use

> ErrorBars.normal 1.0 data

For error bars with endpoints at the maximumn and minimum of the data with given x value, use

> ErrorBars.maxmin data
type alias ErrorBar =
{ x : Float
, y : Float
, top : Float
, bottom : Float
}

The type of an error bar containing (x,y) with extreme points (x,top) and (x,bottom)

mean : Data -> Data

Use to ompute the y-centroids of the data, as in this example:

> SampleData.eb2 |> Data.fromString 0 1 |> ErrorBars.mean
[{ x = 0, y = 1 },{ x = 1, y = 2 }]
normal : Float -> Data -> List ErrorBar

Use to ompute error bars, as in this example:

> SampleData.eb2 |> Data.fromString 0 1 |> ErrorBars.normal 0.5
  [{ bottom = 0.99667, y = 1, top = 1.003333, x = 0 }
  ,{ bottom = 1.98, y = 2, top = 2.02, x = 1 }]
maxmin : Data -> List ErrorBar
> SampleData.eb2 |> Data.fromString 0 1 |> ErrorBars.maxmin
  [{ bottom = 0.9, y = 1, top = 1.1, x = 0 }
   ,{ bottom = 1.8, y = 2, top = 2.2, x = 1 }]