Module

Data.TimeSeries

Package
purescript-timeseries
Repository
carldata/purescript-timeseries

#DataPoint Source

type DataPoint a = { index :: Timestamp, value :: a }

Data point is a time indexed value

#Series Source

data Series a

Data structure for holding Series.

Instances

#dataPoint Source

dataPoint :: forall a. Timestamp -> a -> DataPoint a

Create data point

#index Source

index :: forall a. Series a -> Array Timestamp

Get Series index

#values Source

values :: forall a. Series a -> Array a

Get Series values

#series Source

series :: forall a. Array Timestamp -> Array a -> Series a

Create series from indexes and values

#empty Source

empty :: forall a. Series a

Create an empty series

#fromDataPoints Source

fromDataPoints :: forall a. Array (DataPoint a) -> Series a

Create series from DateTime and value.

#toDataPoints Source

toDataPoints :: forall a. Series a -> Array (DataPoint a)

Conver to array of data points

#fromValues Source

fromValues :: forall a. Array a -> Series a

Create series from values. Index will be based on Timestamp starting from 0

#mkIndex Source

mkIndex :: Int -> Array Timestamp

Create index starting from lowest date (bottom) In each step time is increased by 1 second

#length Source

length :: forall a. Series a -> Int

Get series length.

#slice Source

slice :: forall a. Timestamp -> Timestamp -> Series a -> Series a

Get subseries

#filter Source

filter :: forall a. (a -> Boolean) -> Series a -> Series a

Filter a series, keeping the elements which satisfy a predicate function, creating a new series.

#zipWith Source

zipWith :: forall c b a. (a -> b -> c) -> Series a -> Series b -> Series c

Join 2 series using given function Series will be joinned on index. It means that both series need to have the same index entries If only 1 series contains given index then this item will be dropped

#rollingWindow Source

rollingWindow :: forall b a. Int -> (Array a -> b) -> Series a -> Series b

Apply function to the rolling window and create new Series

#diff Source

diff :: forall a. Ring a => Series a -> Series a

Differentiate Series xt = xt - x(t-1)

#integrate Source

integrate :: forall a. Ring a => Series a -> Series a

Integrate Series

#groupBy Source

groupBy :: forall b a. Number -> (Array a -> b) -> Series a -> Series b

Group series datapoints. This will reduce series data points number by given n.