# TemporalData

TemporalData[{v1,v2,},tspec]

represents temporal data with values vi at times specified by tspec.

TemporalData[{{v11,v12,},{v21,v22,},},tspec]

represents a temporal data collection with values vij at times specified by tspec.

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

represents temporal data specified by time-value pairs {ti,vi}.

TemporalData[{{{t11,v11},{t12,v12}},{{t21,v21},{t22,v22},},}]

represents a temporal data collection given as lists of time-value pairs {tij,vij}.

# Details and Options    • TemporalData represents a collection of paths composed of time-value pairs {tij,vij}.
• The values vij 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,…} {tspec1,tspec2,…} use different times for each path in the collection
• The tij can be numbers or any valid input to AbsoluteTime.
• The values tmin, tmax, and dt can be given as numbers, dates, or Automatic.
• TemporalData objects of equal dimensionality {td1,td2,} can be combined into a single object using TemporalData[{td1,td2,}].
• Normal[td] returns a list containing time-value pairs {tij,vij} for each path.
• Specifying td[t] gives the empirical slice distribution at time t.
• A joint empirical slice distribution for times {t1,t2,} can be obtained by specifying td[{t1,t2,}].
• Properties of a TemporalData object td can be obtained from td["property"].
• A list of available properties can be obtained using td["Properties"].
• Some properties of the collection of paths:
•  "Components" split the collection into individual components "PathCount" the number of paths in the collection "PathLengths" a list containing the length of each path "Paths" a list containing time-value pairs {tij,vij} for each path "DatePaths" a list containing date-value pairs for each path "TimeList" a list containing times tij for each path "DateList" a list containing tij for each path as dates "ValueDimensions" the dimensionality of the values "ValueList" a list containing values vij for each path "FirstTimes" a list of first times for each path "FirstDates" a list of first times for each path as dates "LastTimes" a list of last times for each path "LastDates" a list of last times for each path as dates "FirstValues" a list of values at the first time for each path "LastValues" a list of values at the last time for each path
• If dates are given as input, td["Times"] returns them in AbsoluteTime.
• Some properties for obtaining parts of the collection:
•  "Part" a subset of the original data "Path" time-value pairs {tij,vij} for a given path "DatePath" date-value pairs {dateij,vij} for a given path "PathComponents" split the multivariate path into univariate components "PathFunction" an interpolated path function "Values" values vi for a given path "Times" times ti for a given path "Dates" times ti for a given path as dates "SliceData" a slice through all paths at a given time "SliceDistribution" empirical distribution of slice data at a given time "FirstTime" the first time t1 for a given path "FirstDate" the first time t1 for a given path as date "LastTime" the last time for a given path "LastDate" the last time for a given path as date "FirstValue" the value v1 at the first time for a given path "LastValue" the value at the last time for a given path
• Specifying td["Path",p] gives the time-value pairs for the paths specified by p, where p can be any valid Part specification.
• The property td["PathFunction",p] returns interpolated paths specified by p.
• Specifying td["PathComponent",p] gives the TemporalData for vector components of the values specified by p.
• Specifying td["Part",p,tspec] gives TemporalData for paths specified by p and times specified by tspec. If necessary, the paths are resampled according to "PathFunction".
• Giving td["SliceData",t] returns a slice through all paths at time t, where t can be a number or valid input to AbsoluteTime.
• The specification td["SliceData",{t1,t2,}] gives a multivariate slice at times {t1,t2,}.
• TemporalData 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 metainformation MissingDataMethod None method to use for missing values ResamplingMethod "Interpolation" the method to use for resampling paths ValueDimensions Automatic the dimensions of the values TemporalRegularity Automatic whether to assume the data is regular DateFunction Automatic how to convert dates to standard form
• By default, zero-order interpolation is used for resampling paths. The setting ResamplingMethod->{"Interpolation",opts} can be given, where opts are options passed to Interpolation.
• The setting ValueDimensions->dim specifies that the values vij are of dimension dim. Setting attempts to automatically determine the dimension of the values from the data.
• Setting the will automatically interpolate values with head Missing, according to the ResamplingMethod setting. By default, values with head Missing are treated as missing.
• Information of a TemporalData may include the following properties:
•  "DateInterval" start and end dates "DataPoints" number of data points "Regular" whether data is regularly sampled "OutputDimensions" dimensions of value output "Metadata" all metadata

# Examples

open allclose all

## Basic Examples(3)

Attach temporal information to some values:

Visualize the path:

Create a collection of paths with equivalent times:

Visualize the collection:

Compute the Mean and StandardDeviation at time :

Use dates as time stamps:

Plot the financial time series with DateListPlot:

The value of both stocks on May 24, 2009:

The average value of each stock over the date range:

## Scope(39)

### Basic Uses(5)

Estimate autocorrelation and partial autocorrelation for a time series:

Generate sample paths for a random process, using RandomFunction:

Estimate process parameters, given a sample path:

Compare the CorrelationFunction for the process and data:

Fill in missing values in a time series:

Use linear interpolation to fill in the missing values:

Compute properties for time slices through multiple paths:

Probabilities and expectations:

### Specifying Values and Times(19)

Give a list of values with Automatic time stamps:

Create a path with times 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:

Extract the computed last date:

Create a path 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:

Give an explicit list of times:

Give an explicit list of dates:

Create a collection of three paths with identical time stamps:

Use different time stamps for each path:

Create a collection of paths with different times, but the same values:

Specify a path, using time-value pairs:

Create a path from date-value pairs:

Create a collection of paths from time-value pairs:

Create a collection of paths, using date-value pairs:

Create a path with data involving quantities:

### Properties and Part Extraction(12)

Obtain a list of available properties:

Obtain properties related to the input data:

The number of paths in the collection:

The dimension of the values:

The values used for the first path:

The times for the first path:

Extract paths from the collection:

The first path:

Obtain the fifth path:

Plot three of the paths:

Show all the paths in the ensemble:

Extract components of vector-valued collection:

The first component:

Obtain the second component:

Plot the paths components:

Obtain paths as functions of time:

The first path function:

The 10 path function:

Plot three of the paths:

Show all the paths in the collection:

Obtain slices through the collection of paths at different time points:

A slice at time :

A bivariate slice:

Obtain a slice at a particular date:

Obtain empirical slice distributions for different time points:

An empirical slice distribution at time 0.25:

A bivariate empirical slice distribution:

Obtain a subset of the original data:

Take odd-numbered paths over the time range 0.2 to 0.8:

Resample data over a given set of times:

Upsample the original path in steps of 0.25:

The new data is sampled from the path function:

Resample data over a given set of days:

Temporal data involving quantities:

The values are given as QuantityArray:

Extract quantity unit information:

Extract quantity magnitudes:

### Temporal Data Arithmetic(3)

Numerical, listable functions automatically thread over values of TemporalData:

Compare to the result of TimeSeriesMap:

Combining several TemporalData objects with identical time stamps threads over values:

Create new temporal data of quantity magnitudes from existing temporal data involving quantities:

Create new temporal data of quantity units:

## Options(21)

### CalendarType(1)

Specify timestamps 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 the TimeZone of the inputs:

### HolidayCalendar(1)

Use HolidayCalendar to visualize business days in a given country:

### MetaInformation(3)

The properties now include the metadata "Event":

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 TemporalData:

Extract second component:

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

### MissingDataMethod(5)

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

The setting Automatic will use the ResamplingMethod setting:

Use cubic interpolation to interpolate the path:

With ResamplingMethod set to None, missing values will not be interpolated:

Use a custom interpolation for filling in missing values:

The method for handling missing data need not match the ResamplingMethod:

Retain missing data indices as metainformation:

Highlight the interpolated regions:

### ResamplingMethod(6)

By default, "PathFunction" gives zero-order paths that hold their value from the left:

Set the InterpolationOrder to 1:

Use zero-order interpolation that holds its value from the right:

Use a constant value:

Use cubic spline interpolation for paths:

The interpolating method used can impact the value of time slices:

Time stamps for the paths:

Time points in between the time stamps:

Setting the method to None will treat values not present in the data as missing:

Equivalently, use a constant Missing[]:

### TemporalRegularity(1)

Explicitly assume that temporal data is regularly spaced:

Internal representation of times:

New internal representation of times:

### TimeZone(1)

Specify the time zone of TemporalData:

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

### ValueDimensions(1)

By default, the dimensionality of the values is inferred from the data:

The input is interpreted as 25 separate paths:

Setting the ValueDimensions to 2 treats the data as a single path of dimension 2:

## Applications(2)

Reproduce the mean function for a random process:

Compare the variance function for the data with the variance function for the process:

Compare the moment functions of order 4:

Estimate the variance for a slice of TransformedProcess:

Compare with the actual variance:

## Properties & Relations(3)

Some equivalence relationships:

Two ways to extract the collection of paths:

Two ways to obtain the first path in the ensemble:

Slice distributions at time :

TemporalData is related to TimeSeries:

TimeSeries can contain only a single path:

The slicing behavior of TimeSeries differs from TemporalData:

TimeSeries objects can be combined into a single TemporalData object:

TemporalData is a generalization of EventSeries:

Unlike TemporalData, EventSeries does not interpolate:

## Possible Issues(3)

The dimensionality of the values can be ambiguous:

By default, this is interpreted as an ensemble of five paths of dimension 1:

Setting the ValueDimensions to 2 treats the data as a single path of dimension 2:

Accumulating irregularly sampled temporal data:

Accumulate will resample to create regularly sampled temporal data:

Compare with accumulated values:

To recover that behavior, assume TemporalRegularity:

Another way is to specify ResamplingMethod by setting new values to 0:

If the ResamplingMethod specification is not an implemented one, it will assume the value Automatic:

## Neat Examples(1)

Animate the movement of the continental plates during the Mesozoic Era: