[
    {
        "name": "Trend.Linear",
        "comment": " Calculate trends for linear data (that is, data with one dependent\nand one independent variable whose relationship can be described a `y\n= mx + b`)\n\nThe easiest way to determine if a relationship is linear is to plot of\nyour values . If your data form a rough line, we're in business. But\nif your plot shows a curve or a random point cloud then don't trust\nthe results you get from these functions. (n.b. check out\n`terezka/elm-plot`, which makes this very easy!)\n\nSome kinds of data which fit these criteria:\n\n  - the relationship between some value and time. For example, are\n    bananas getting cheaper or more expensive as time goes on? Does\n    running something twice take exactly twice as long as running it\n    once?\n  - Big sociological questions: does an increase in healthcare\n    spending lead to longer life expectancy? How much does\n    socioeconomic status depend on education levels?\n\n@docs Trend, Quick, Robust\n\n\n## Using Trend Lines\n\n@docs Line, line, predictY\n\n\n# Creating Trends\n\n@docs Point\n\n\n## Quick Fit\n\n@docs quick, goodnessOfFit\n\n\n## Robust Fit\n\n@docs robust, confidenceInterval\n\n",
        "unions": [
            {
                "name": "Quick",
                "comment": " a trend calculated from [`quick`](#quick)\n",
                "args": [],
                "cases": []
            },
            {
                "name": "Robust",
                "comment": " a trend calculated from [`robust`](#robust)\n",
                "args": [],
                "cases": []
            },
            {
                "name": "Trend",
                "comment": " ",
                "args": [
                    "kind"
                ],
                "cases": []
            }
        ],
        "aliases": [
            {
                "name": "Line",
                "comment": " The result of a trend prediction. Use this to make predictions\nusing [`predictY`](#predictY).\n",
                "args": [],
                "type": "{ slope : Float, intercept : Float }"
            },
            {
                "name": "Point",
                "comment": " a single 2-dimensional point\n",
                "args": [],
                "type": "( Float, Float )"
            }
        ],
        "values": [
            {
                "name": "confidenceInterval",
                "comment": " Calculate a confidence interval from a robust set of\ndata. [Consult\nWikiPedia](https://en.wikipedia.org/wiki/Confidence_interval) for a\nthorough understanding of what this may mean for your data set. This\nfunction gives a 95% confidence interval.\n\n**Maintainer's note:** We ought to be able to generate a confidence\ninterval for quick trends too, but I'm not confident enough in my math\nskills to do it correctly. Help wanted here! If you know how to do\nthat calculation, let's work together and add it.\n\n",
                "type": "Trend Robust -> ( Line, Line )"
            },
            {
                "name": "goodnessOfFit",
                "comment": " Get the goodness of fit for a quick trend. This is a number\nbetween 0 to 1. A higher number generally indicates a better fit, but\nit doesn't know anything about what your data _means_. This means that\nyou have to use some judgement in interpreting it!\n\n    quick [ (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) ]\n        |> Result.map goodnessOfFit\n        --> Ok 1\n\nAnd again with that outlier from [`quick`](#quick):\n\n     --                                       vvvvv\n     quick [ (1, 1), (2, 2), (3, 3), (4, 4), (5, -5) ]\n         |> Result.map goodnessOfFit\n         --> Ok 0.19999999999999996\n\nThis calculation is only valid for [`quick`](#quick) trends, since it\nmeasures how well a fit has minimized the square sum of error. That\nmeans it's only really useful for ordinary least squares, not the\nTheil-Sen estimator we use for [`robust`](#robust)\n\n**Maintainer's note:** this will evaluate the fit for the original\ndata. If you need to evaluate goodness of fit for _new_ data given an\nexisting `Trend`, we'll need to expose a new function. I don't have a\nconcrete use case for this, so the function does not corrently\nexists. I want to make this library work for you, so please [open an\nissue](https://github.com/BrianHicks/elm-trend/issues/new) if you find\nyourself in this situation!\n\n",
                "type": "Trend Quick -> Float"
            },
            {
                "name": "line",
                "comment": " Extract a line from a trend.\n",
                "type": "Trend a -> Line"
            },
            {
                "name": "predictY",
                "comment": " Given an `x`, predict `y`.\n\n    predictY { slope = 1, intercept = 0 } 1\n        --> 1\n\n    predictY { slope = -1, intercept = 0 } 5.5\n        --> -5.5\n\n",
                "type": "Line -> Float -> Float"
            },
            {
                "name": "quick",
                "comment": " Plot a line through a series of points `(x, y)`. So given a\nperfect linear relationship:\n\n     quick [ (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) ]\n         |> Result.map line\n         --> Ok { slope = 1, intercept = 0 }\n\nThis is the fastest of the functions in this module, but it's also the\nmost susceptible to being thrown off by outliers. Let's look at that\nline again, but with an outlier:\n\n     --                                       vvvvv\n     quick [ (1, 1), (2, 2), (3, 3), (4, 4), (5, -5) ]\n         |> Result.map line\n         --> Ok { slope = -0.9999999999999999, intercept = 3.9999999999999996 }\n\nThe more outliers you have, the worse fit you'll get. You can figure\nout if this is happening by sending your the result of this function\nto [`goodnessOfFit`](#goodnessOfFit).\n\nUnder the covers, this is an [ordinary least squares\nregression](https://en.wikipedia.org/wiki/Ordinary_least_squares).\n\n",
                "type": "List Point -> Result Error (Trend Quick)"
            },
            {
                "name": "robust",
                "comment": " When your data has outliers, you'll want to use a robust estimator\ninstead of the quick estimator. This is much slower (it runs roughly\nin `O(n^2)` time), but will still give good results in the face of\ncorrupted data. Specifically, it will still work if up to ~29.3% of\nyour data consists of outliers. And again, the easiest way to check\nthis is to visualize it with `terezka/elm-plot` or something similar.\n\nFor good data, we have the same results as [`quick`](#quick):\n\n     robust [ (1, 1), (2, 2), (3, 3), (4, 4), (5, 5) ]\n         |> Result.map line\n         --> Ok { slope = 1, intercept = 0 }\n\nBut when we have outliers, we still get a good result:\n\n     --                                        vvvvv\n     robust [ (1, 1), (2, 2), (3, 3), (4, 4), (5, -5) ]\n         |> Result.map line\n         --> Ok { slope = 1, intercept = 0 }\n\nUnder the covers, this is a [Theil-Sen\nestimator](https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator)\n(which is pretty cool and easy to get an intuitive grasp of what's\ngoing on; check it out!)\n\n",
                "type": "List Point -> Result Error (Trend Robust)"
            }
        ],
        "binops": []
    },
    {
        "name": "Trend.Math",
        "comment": " Math helpers for calculating trends.\n\n@docs Error\n\n@docs mean, stddev, correlation\n\n",
        "unions": [
            {
                "name": "Error",
                "comment": " Indicate that something has gone wrong in the caculation of a\ntrend line. Specifically:\n\n  - `NeedMoreValues`: there was not enough data to calculate a\n    value. The attached `Int` is the minimum required.\n  - `AllZeros`: this likely means you've tried to plot a point\n    through a bunch of zeroes, or a values that are very very close to\n    zero. If that's not the case, please open an issue.\n\n",
                "args": [],
                "cases": [
                    [
                        "NeedMoreValues",
                        [
                            "Int"
                        ]
                    ],
                    [
                        "AllZeros",
                        []
                    ]
                ]
            }
        ],
        "aliases": [],
        "values": [
            {
                "name": "correlation",
                "comment": " Get the correlation coefficient for some values. The returned\nvalue will be between 0 (no correlation) and 1 (perfect correlation.)\n\n    correlation [ (1, 1), (2, 2), (3, 3), (4, 4) ]\n        --> Ok 1\n\nMinimum required values: 2\n\nUnder the covers, this is a Pearson correlation coefficient.\n\n",
                "type": "List ( Float, Float ) -> Result Error Float"
            },
            {
                "name": "mean",
                "comment": " Calculate the mean (average) for some values.\n\n    mean [ 1, 2, 3, 4, 5 ]\n        --> Ok 3\n\n",
                "type": "List Float -> Result Error Float"
            },
            {
                "name": "stddev",
                "comment": " Calculate the standard deviation for some values.\n\n    mean [ 1, 2, 3, 4, 5 ]\n        --> Ok 3\n\n",
                "type": "List Float -> Result Error Float"
            }
        ],
        "binops": []
    }
]