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:
-
Automatic use 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 $TimeZone the time zone to use MetaInformation None include additional meta-information MissingDataMethod None method to use for missing values TemporalRegularity Automatic whether to assume the data is regular DateFunction Automatic how to convert dates to standard form ValueDimensions Automatic the 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 allScope (31)
Basic Uses (9)
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:
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 :
Dates can be given as any valid input to AbsoluteTime:
Use equally spaced times from 10 to 50:
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:
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:
Extract components of vector-valued collection:
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:
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:
Options (11)
CalendarType (1)
Specify time stamps as dates in a specific calendar using CalendarType:
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:
Use MetaInformation to name the components in a vector-valued EventSeries:
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:
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:
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:
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 from Champaign, IL:
Accumulate the event series and convert to distance units:
Calculate distances to a few cities within the maximum distance:
The quantity values of the event series are given as a QuantityArray and need Normal:
Plot the cumulative number of steps with the distance marked by the cities:
Filtering (1)
Use MeanFilter to filter an event series:
Earthquakes (1)
Notable Dates (1)
The event series of birthdays of American presidents:
Use AssociationThread to plot dates with names:
Properties & Relations (3)
EventSeries does not interpolate the values between time stamps:
Use TimeSeries to represent continuous times:
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:
Possible Issues (1)
Multidimensional data may be confused with time-value pairs:
Specify ValueDimensions to treat the data as vector-valued:
Text
Wolfram Research (2014), EventSeries, Wolfram Language function, https://reference.wolfram.com/language/ref/EventSeries.html (updated 2015).
CMS
Wolfram Language. 2014. "EventSeries." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/EventSeries.html.
APA
Wolfram Language. (2014). EventSeries. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EventSeries.html