timeseries-0.4.1: Library for Time Series processing

Data.TimeSeries

Description

TimeSeries library

Synopsis

Series datatype

data DataPoint a Source #

Data points is a time indexed value

Instances

 Source # Methodsfmap :: (a -> b) -> DataPoint a -> DataPoint b #(<$) :: a -> DataPoint b -> DataPoint a # Source # Methodsfold :: Monoid m => DataPoint m -> m #foldMap :: Monoid m => (a -> m) -> DataPoint a -> m #foldr :: (a -> b -> b) -> b -> DataPoint a -> b #foldr' :: (a -> b -> b) -> b -> DataPoint a -> b #foldl :: (b -> a -> b) -> b -> DataPoint a -> b #foldl' :: (b -> a -> b) -> b -> DataPoint a -> b #foldr1 :: (a -> a -> a) -> DataPoint a -> a #foldl1 :: (a -> a -> a) -> DataPoint a -> a #toList :: DataPoint a -> [a] #null :: DataPoint a -> Bool #length :: DataPoint a -> Int #elem :: Eq a => a -> DataPoint a -> Bool #maximum :: Ord a => DataPoint a -> a #minimum :: Ord a => DataPoint a -> a #sum :: Num a => DataPoint a -> a #product :: Num a => DataPoint a -> a # Eq a => Eq (DataPoint a) Source # Methods(==) :: DataPoint a -> DataPoint a -> Bool #(/=) :: DataPoint a -> DataPoint a -> Bool # Show a => Show (DataPoint a) Source # MethodsshowsPrec :: Int -> DataPoint a -> ShowS #show :: DataPoint a -> String #showList :: [DataPoint a] -> ShowS # data Series a Source # Data structure for holding Series. Implementation should be hidden so it can be changed in the future Instances  Source # Methodsfmap :: (a -> b) -> Series a -> Series b #(<$) :: a -> Series b -> Series a # Source # Methodsfold :: Monoid m => Series m -> m #foldMap :: Monoid m => (a -> m) -> Series a -> m #foldr :: (a -> b -> b) -> b -> Series a -> b #foldr' :: (a -> b -> b) -> b -> Series a -> b #foldl :: (b -> a -> b) -> b -> Series a -> b #foldl' :: (b -> a -> b) -> b -> Series a -> b #foldr1 :: (a -> a -> a) -> Series a -> a #foldl1 :: (a -> a -> a) -> Series a -> a #toList :: Series a -> [a] #null :: Series a -> Bool #length :: Series a -> Int #elem :: Eq a => a -> Series a -> Bool #maximum :: Ord a => Series a -> a #minimum :: Ord a => Series a -> a #sum :: Num a => Series a -> a #product :: Num a => Series a -> a # Eq a => Eq (Series a) Source # Methods(==) :: Series a -> Series a -> Bool #(/=) :: Series a -> Series a -> Bool # Show a => Show (Series a) Source # MethodsshowsPrec :: Int -> Series a -> ShowS #show :: Series a -> String #showList :: [Series a] -> ShowS #

Get data point index.

dpValue :: DataPoint a -> a Source #

Get data point value.

Create series

Create empty series.

Arguments

 :: [Integer] List of index value given as number of seconds -> [a] List of value -> Series a Created Series

Create time series from timestamps and values

seriesFromSeconds [1, 2, 3] [41.3, 52.22, 3.0] == Series [DP 1970-01-01 00:00:01 UTC 2.3,DP 1970-01-01 00:00:02 UTC 4.5]

series :: [(UTCTime, a)] -> Series a Source #

Create series from UTCTime and value.

Conversion between types

toList :: Series a -> [(UTCTime, a)] Source #

Convert Time Series to the list.

values :: Series a -> [a] Source #

Get series values as list.

Selecting data from series

Arguments

 :: TimeResolution Window size -> ([a] -> b) Function applied to each window -> Series a Input Series -> Series b Converted Series

Apply rolling window to create a new Series. Rolling window is also called Sliding Window.

Arguments

 :: Fractional a => UTCTime Starting time -> TimeResolution Resampling resolution -> Series a Input series -> Series a Resampled series

Resample Series.

size :: Series a -> Int Source #

Get series size. Complexity O(n)

size (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) == 3

Arguments

 :: UTCTime Start time (inclusive) -> UTCTime End time (inclusive) -> Series a Input series -> Series a Sliced Series

Return series subset. Complexity O(n)

slice (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 2 3 == Series [DP 2 52.22, DP 3 3.0]
slice (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 5 23 == Series []

Arguments

 :: UTCTime Index position -> Series a Input Series -> Maybe a Value at given index

Return data point value at given index Complexity O(n)

valueAt (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 2 == Just 52.22
valueAt (Series [DP 1 41.3, DP 2 52.22, DP 3 3.0]) 5 == Nothing

mean :: Fractional a => Series a -> a Source #

Return Time Series mean

std :: Floating a => Series a -> a Source #

Calculate Time Series Standard Deviation

variance :: Floating a => Series a -> a Source #

Calculate Time Series variance

TimeResolution is for holding time periods which can't easy be translated to number of seconds For example day doesn't always have 86400 and month have different number of days. So if we want to define 1 month period we can't use DiffTime for it.

Create Time Resolution from days

Create Time Resolution from months

Return Time Series mean

Create Time Resolution from seconds

Create Time Resolution from years