TimeSeriesResample

TimeSeriesResample[tseries]

uniformly resamples tseries according to its minimum time increment.

TimeSeriesResample[tseries,rspec]

resamples tseries according to rspec.

Details and Options

  • TimeSeriesResample is often used to convert irregular time series to regular ones. It can also be used to align time series.
  • The time series tseries can be a list of values {x1,x2,}, a list of time-value pairs {{t1,x1},{t2,x2},}, a TimeSeries, an EventSeries, or TemporalData.
  • Some basic settings for rspec include:
  • dtuse uniform times with spacing dt
    {t_(0),t_(1),dt}use times t0 to t1 with spacing dt
    {{t1,t2,}}use explicit times {t1,t2,}
    dayspecuse day specification
  • Possible dayspec types are: "Weekday", "Weekend", Monday through Sunday, "BeginningOfMonth", "EndOfMonth", "BusinessDay" and "Holiday".
  • If dt is set to Automatic, the minimum time increment in tseries is used.
  • The following settings for rspec are useful if tseries contains multiple paths:
  • "Union"use all times present in tseries
    "Intersection"use times common to all paths
    {"Times",p}use times from path p
  • If times are not given, then tseries is assumed to be regular with unit spacing.
  • TimeSeriesResample takes the following option:
  • ResamplingMethodAutomaticthe method to use for resampling paths
    CalendarType"Gregorian"the calendar system to interpret the dates
    HolidayCalendar{"UnitedStates","Default"}the holiday calendar schedule for business days
    TimeZoneAutomaticthe time zone specification for dates

Examples

open all close all

Basic Examples  (3)

Resample a time series:

In[1]:=
Click for copyable input
Out[1]=

Resampling with spacing smaller than the minimum time increment will add time stamps:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

Resampling with spacing larger than the minimum time increment:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

Resample time series with dates:

In[1]:=
Click for copyable input
Out[1]=

Select business days:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Select weekends:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=

Select Wednesdays:

In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=

Resample an irregular data:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Resample with step of 2:

In[4]:=
Click for copyable input
In[5]:=
Click for copyable input
Out[5]=

The resampled time series is now regularly sampled:

In[6]:=
Click for copyable input
Out[6]=

Scope  (13)

Options  (6)

Applications  (5)

Possible Issues  (1)

Introduced in 2014
(10.0)
|
Updated in 2019
(12.0)