Copyright | (C) 2014 Samuli Thomasson |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | Samuli Thomasson <samuli.thomasson@paivola.fi> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Forecast
Description
Regression utilities.
- type Predict = StateT (Vector Epoch, Vector Double) IO
- simpleLinearRegression :: (Eq n, Fractional n, Storable n) => Vector n -> Vector n -> Maybe (n, n, n)
- drawFuture :: Double -> Double -> Maybe (Epoch, Double) -> Vector Epoch -> Vector Double
- data Filter = Filter {}
- data FilterAggregate
- applyFilter :: Filter -> Predict ()
- apply :: (Real b, Fractional b) => FilterAggregate -> Vector (a, b) -> (a, b)
- splittedAt :: Epoch -> Epoch -> Vector Epoch -> Vector (Int, Epoch)
- vectorAvg :: (Real a, Fractional a) => Vector a -> a
- vectorMedian :: Vector a -> a
- aesonOptions :: Options
Documentation
simpleLinearRegression :: (Eq n, Fractional n, Storable n) => Vector n -> Vector n -> Maybe (n, n, n)
`simpleLinearRegression xs ys` gives (a, b, r2) for the line y = a * x + b.
Arguments
:: Double | a |
-> Double | b |
-> Maybe (Epoch, Double) | draw starting at (time, value) |
-> Vector Epoch | clocks |
-> Vector Double |
y - y0 = a * (x - x0) ==> y = a * x + (y0 - a * x0) = a * x + b'
Filters
data Filter
Constructors
Filter | |
Fields
|
data FilterAggregate
applyFilter :: Filter -> Predict ()
apply :: (Real b, Fractional b) => FilterAggregate -> Vector (a, b) -> (a, b)
splittedAt :: Epoch -> Epoch -> Vector Epoch -> Vector (Int, Epoch)
Fold left; accumulate the current index (and timestamp) when day changes.
Utility
vectorAvg :: (Real a, Fractional a) => Vector a -> a
vectorMedian :: Vector a -> a