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:
-
dt use uniform times with spacing dt use times t0 to t1 with spacing dt {{t1,t2,…}} use explicit times {t1,t2,…} dayspec use 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:
-
ResamplingMethod Automatic the 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 TimeZone Automatic the time zone specification for dates
Examples
open allclose allBasic Examples (3)
Scope (13)
Basic Uses (3)
Resample at a granularity of 0.25:
Sample multiple paths at the same time:
Resample at a granularity of 0.1:
Resample at a daily resolution, interpolating holidays and weekends:
Alternatively, insert Missing:
Data Types (6)
Resample a time series in the form of a vector:
A time series given as time-value pairs:
Resample a TimeSeries:
Resample an EventSeries:
By default, an event series is not interpolated:
Setting the ResamplingMethod overrides this:
A single path given as TemporalData:
Multiple paths given as TemporalData:
Options (6)
ResamplingMethod (3)
Resample irregular data using linear interpolation:
By default, the method setting for the data is used:
Setting ResamplingMethod to None gives missing values for irregular data:
HolidayCalendar (1)
Applications (5)
This time series contains the number of steps taken daily by a person during a period of five months:
Analyze the number of steps depending on the day of the week:
Select the values for each day of the week:
Compute the mean number of steps for each day of the week:
Visualize the mean steps per day:
Financial information is generated only for business days:
The automatically created time series is not regularly sampled:
Resample according to "BusinessDay" to create a uniformly sampled time series:
The data is generated only for business days. There are no changes on the remaining days; hence, we can resample by day by keeping the value from the left:
The plot is flat over the weekends and holidays:
Use AirPressureData to examine pressure changes due to Hurricane Sandy at Long Island MacArthur Airport:
The data is not regularly sampled:
To analyze the rate of change, data needs to be resampled into a regularly sampled time series:
Plotting each observation disjointly shows the rate of change of the pressure, with larger spacing indicating faster changes:
Analyze the monthly temperatures in Champaign during 2014:
Possible Issues (1)
The original time stamps may not be preserved after resampling:
Note that the time series is not regularly sampled:
Resample according to MinimumTimeIncrement:
Text
Wolfram Research (2014), TimeSeriesResample, Wolfram Language function, https://reference.wolfram.com/language/ref/TimeSeriesResample.html (updated 2019).
CMS
Wolfram Language. 2014. "TimeSeriesResample." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/TimeSeriesResample.html.
APA
Wolfram Language. (2014). TimeSeriesResample. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TimeSeriesResample.html