TimeSeries

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

represents a time series specified by time-value pairs {ti,vi}.

TimeSeries[{v1,v2,},tspec]

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

Details and Options

• TimeSeries 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 ts[t] gives the value of the time series at time t.
• TimeSeries is a special case of TemporalData allowing only a single path.
• TimeSeries objects of equal dimensionality {ts1,ts2,} can be combined into a TemporalData object using TemporalData[{ts1,ts2,}].
• Properties of a TimeSeries object ts can be obtained from ts["property"].
• A list of available properties can be obtained using ts["Properties"].
• Some properties of the time series include:
•  "Path" time-value pairs {{t1,v1},…} "PathFunction" an interpolated path function "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
• If dates are given as input, ts["Times"] returns them in AbsoluteTime.
• Normal[ts] is equivalent to ts["Path"].
• TimeSeries takes the following options:
•  CalendarType "Gregorian" the calendar type to use HolidayCalendar {"UnitedStates","Default"} the holiday calendar to use MetaInformation None include additional meta-information MissingDataMethod None method to use for missing values ResamplingMethod "Interpolation" the method to use for resampling paths TemporalRegularity Automatic whether to assume the data is regular DateFunction Automatic how to convert dates to standard form
• By default, first-order interpolation is used for resampling. The setting ResamplingMethod->{"Interpolation",opts} can be given, where opts are options passed to Interpolation.
• Setting the will automatically interpolate values with head Missing according to the ResamplingMethod setting. By default, values with head Missing are treated as missing.

Examples

open allclose all

Basic Examples(2)

Create a time series from some values and times:

 In[1]:=
 In[3]:=
 Out[3]=

Visualize the path:

 In[4]:=
 Out[4]=

Use dates as time stamps:

 In[1]:=

Plot the time series with DateListPlot:

 In[2]:=
 Out[2]=

The value of the stock on May 24, 2009:

 In[3]:=
 Out[3]=

The average value of the stock over the date range:

 In[4]:=
 Out[4]=