EventSeries

EventSeries[{{t1,v1},{t2,v2}}]

represents a series of events given as time-value pairs {ti,vi}.

EventSeries[{v1,v2,},tspec]

represents a series of events with values vi at times specified by tspec.

Details and Options

  • EventSeries represents a series of time-value pairs {ti,vi}.
  • The values vi can be scalars or arrays of any dimension, but must all be of equal dimensionality.
  • The following times tspec can be given:
  • Automaticuse uniformly spaced times starting at 0
    {tmin}use uniformly spaced times starting at tmin
    {tmin,tmax}use uniformly spaced times tmin to tmax
    {tmin,tmax,dt}use times tmin to tmax in steps of dt
    {{t1,t2,}}use explicit times {t1,t2,}
  • The ti can be numbers or any valid input to AbsoluteTime.
  • The values tmin, tmax, and dt can be given as numbers, dates, or Automatic.
  • Specifying es[t] gives the event value at time t.
  • EventSeries is a special case of TemporalData allowing only a single path and no interpolation.
  • EventSeries objects of equal dimensionality {es1,es2,} can be combined into a TemporalData object using TemporalData[{es1,es2,}].
  • Properties of an EventSeries object es can be obtained from es["property"].
  • A list of available properties can be obtained using es["Properties"].
  • Some properties of the event series include:
  • "Path"time-value pairs {{t1,v1},}
    "PathComponents"split the multivariate path into univariate components
    "PathFunction"an interpolated path function
    "PathLength"the length of the path
    "Values"the values {v1,}
    "ValueDimensions"the dimensionality of the vi
    "Times"the times {t1,}
    "Dates"the times {t1,} as dates
    "DatePath"date-value pairs {{date1,v1},}
    "FirstTime"the first time t1
    "FirstDate"the first time t1 as date
    "LastTime"the last time
    "LastDate"the last time as date
    "FirstValue"the value v1 at the first time
    "LastValue"the value at the last time
  • Specifying es["PathComponent",p] gives the EventSeries for vector components of the values specified by p.
  • If dates are given as input, es["Times"] returns them in AbsoluteTime.
  • Normal[es] is equivalent to es["Path"].
  • EventSeries takes the following options:
  • CalendarType"Gregorian"the calendar type to use
    HolidayCalendar{"UnitedStates","Default"}the holiday calendar to use
    TimeZone$TimeZonethe time zone to use
    MetaInformationNoneinclude additional meta-information
    MissingDataMethodNonemethod to use for missing values
    TemporalRegularityAutomaticwhether to assume the data is regular
    DateFunctionAutomatichow to convert dates to standard form
    ValueDimensionsAutomaticthe dimensions of the values
  • Setting the MissingDataMethod->Automatic will automatically interpolate values with head Missing by value from the left. By default, values with head Missing are treated as missing.
  • The setting ValueDimensions->dim specifies that the values vij are of dimension dim. Setting ValueDimensions->Automatic attempts to automatically determine the dimension of the values from the data.

Examples

open allclose all

Basic Examples  (1)

Attach temporal information to some events:

Visualize the path:

Scope  (31)

Basic Uses  (9)

Visualize an event series:

Use TimeSeriesWindow to extract a portion of an event series:

Use TimeSeriesInsert to insert a missing value:

Use TimeSeriesRescale to rescale an event series to run from 0 to 20:

Use TimeSeriesShift to shift the series ahead by 2:

Square the values of an event series:

Use TimeSeriesMap to find the sums of the components of a vector-valued event series:

Find the Mean of the values in an event series:

Compute a MovingAverage:

Moving maximum:

Use TimeSeriesAggregate to compute a width-5 total for an event series:

Use TimeSeriesModelFit for fitting a parametric model to an event series:

Forecast the next 10 values in the event series:

Plot the event series along with the forecast:

Compute the differences between two event series:

Use TimeSeriesThread to compute maximum event series:

Creating an Event Series  (15)

Give a list of values with Automatic time stamps:

Create an event series starting at :

Use dates for starting times:

Dates can be given as any valid input to AbsoluteTime:

Use equally spaced times from 10 to 50:

Give a range of dates to use:

Specify an Automatic endpoint:

Create a series with times 1 to 20 in steps of 2:

Use an Automatic endpoint and fixed step:

Extract the computed last date:

Use an Automatic start point and given frequency:

Extract the computed first time:

Explicitly specify the times to use:

Give an explicit list of dates:

Give the time-value pairs:

Create an event series from date-value pairs:

Create an event series from data involving quantities:

Some ExampleData has EventSeries defined:

Extracting Properties and Values  (4)

Obtain a list of available properties:

Values used for the event series:

Times:

Time-value pairs:

Plot the event series:

Extract components of vector-valued collection:

The first component:

Obtain the second component:

Plot the paths components:

Resample data over a given set of times:

Subsample the original path in steps of 2:

The new data is sampled from the path function:

Event series involving quantities:

The values are given as QuantityArray:

Extract quantity unit information:

Extract quantity magnitudes:

Event Series Arithmetic  (3)

Numerical, listable functions automatically thread over values of event series:

Compare to the result of TimeSeriesMap:

Combining several event series with identical time stamps threads over values:

Create a new event series of quantity magnitudes from existing event series involving quantities:

Create a new time series of quantity units:

Options  (11)

CalendarType  (1)

Specify time stamps as dates in a specific calendar using CalendarType:

By default, the "Gregorian" calendar is being used:

DateFunction  (2)

Use DateList to define functions for interpreting ambiguous date strings:

Use DateObject to define functions for interpreting ambiguous date strings:

Specify TimeZone of the inputs:

HolidayCalendar  (1)

Use HolidayCalendar to visualize business days in a given country:

MetaInformation  (3)

Include additional metadata as a list of rules:

The properties now include the metadata "Stock":

The added metadata can be used like any other property:

Use MetaInformation to specify PlotLegends:

See the available MetaInformation:

Access specific information directly:

Visualize the data:

Use MetaInformation to name the components in a vector-valued EventSeries:

Extract second component:

Extract first and third components using either their name or number:

MissingDataMethod  (1)

By default, values with head Missing are interpreted as missing:

Use MissingDataMethod to replace missing values with a constant:

Use interpolation to replace the missing values:

TemporalRegularity  (1)

Explicitly assume that data is regularly spaced:

TimeZone  (1)

Specify the time zone of EventSeries:

The time stamps were created in $TimeZone but the dates are displayed in the time zone specified by the option:

Value Dimensions  (1)

Specify the dimensionality of the values:

Applications  (6)

Accidental Deaths  (1)

The number of accidental deaths in the United States was recorded monthly for six years:

Fit an ARProcess to the data:

The model misses the seasonality in the data:

The diagnostic plots suggest a model with seasonality of 12 is needed:

The seasonal model seems to generally outperform the non-seasonal one:

Obtain an empirical estimate of the 90% forecast prediction limits two months into the future:

Compare to the asymptotic estimates:

Fitness  (2)

Event series for the number of steps taken daily by a person between April 1 and September 1:

Compute the mean and median number of steps:

The second event series represents high-activity minutes per day:

Plot the time series and its moving mean over 40 days:

Compare cumulative totals of the daily number of steps with geographical reference points between Cambridge, MA, and Champaign, IL:

Accumulate the event series:

Calculate distances to a few cities on the way:

Plot the cumulative number of steps with the distance marked by the cities:

Filtering  (1)

Use MeanFilter to filter an event series:

Earthquakes  (1)

The magnitude of earthquakes with magnitude at least 6:

Show the distributions of the magnitudes:

Find the conditional probability of a magnitude 7 or greater earthquake in the given time interval:

Notable Dates  (1)

The event series of birthdays of American presidents:

Plot the dates:

Use AssociationThread to plot dates with names:

Birthday distribution within a year:

Find shared birthdays:

Properties & Relations  (3)

EventSeries does not interpolate the values between time stamps:

Use TimeSeries to represent continuous times:

Both agree on time stamps:

However, TimeSeries interpolates the values between time stamps:

You can convert from one to the other:

EventSeries can contain a single path only:

The event series has only one path:

Create individual EventSeries for each row of data:

Compare to the first row of the data:

Use TemporalData to contain multiple paths:

EventSeries at a point returns a value or Missing[]:

Evaluating at a time stamp and in between time stamps:

Use TemporalData to store multiple paths and obtain distribution of the values at a point:

Evaluating at a time stamp and in between time stamps:

Possible Issues  (1)

Multidimensional data may be confused with time-value pairs:

Specify ValueDimensions to treat the data as vector-valued:

Neat Examples  (1)

Create a moon calendar for January:

Introduced in 2014
 (10.0)
 |
Updated in 2015
 (10.1)