Module

Data.TimeSeries

Package
purescript-timeseries
Repository
carldata/purescript-timeseries

#DataPoint Source

data DataPoint a

Data point is a time indexed value

Instances

#Series Source

data Series a

Data structure for holding Time Series.

Instances

#dataPoint Source

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

Create data point

#dpIndex Source

dpIndex :: forall a. DataPoint a -> Timestamp

Get DataPoint index

#dpValue Source

dpValue :: forall a. DataPoint a -> a

Get DataPoint value

#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

#ensureInc Source

ensureInc :: forall a. Array Timestamp -> Array a -> Tuple (Array Timestamp) (Array a)

Ensure that index is monotonically increasing

#fromDataPoints Source

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

Create series from DataPoints.

#toDataPoints Source

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

Convert series to the 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

#length Source

length :: forall a. Series a -> Int

Get series length.

#head Source

head :: forall a. Series a -> Maybe (DataPoint a)

Get first element if exists

#last Source

last :: forall a. Series a -> Maybe (DataPoint a)

Get last element if exists

#resolution Source

resolution :: forall a. Series a -> Number

Get distance between points in this series

#slice Source

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

Get subseries within given range. Lower and upper range is inclusive.

#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.

#take Source

take :: forall a. Int -> Series a -> Series a

Take n first elements of the series. Drop rest

#drop Source

drop :: forall a. Int -> Series a -> Series a

Drop n first elements of the series. Keep rest

#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.

Value is put at the last element of the window

#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 points.

First Number defines window size in milliseconds

#reindex Source

reindex :: Number -> Series Number -> Series Number

Reindex series. Ensure that series has point at each index value So there are no missing values.