Wolfram Language

Time Series Processing

Use Databin to Store Time Series

The arrival times in a PoissonProcess are independent and follow an ExponentialDistribution. You can simulate a path of a PoissonProcess by sending signals to a Databin in time intervals specified by a simulation of an exponential distribution.

In[1]:=
Click for copyable input
SeedRandom["11"]; \[Lambda] = 0.5; times = RandomVariate[ExponentialDistribution[\[Lambda]], 30];

Create a Databin.

In[2]:=
Click for copyable input
bin = CreateDatabin[]
Out[2]=

Use the simulated times to send 1 to the databin in time intervals.

In[3]:=
Click for copyable input
Table[DatabinAdd[bin, <|"arrivals" -> 1|>]; Pause[t], {t, times}];

The recorded signal with the time stamps.

In[4]:=
Click for copyable input
TimeSeries[bin]
Out[4]=

Extract the TimeSeries object.

In[5]:=
Click for copyable input
ts1 = TimeSeries[bin]["arrivals"]
Out[5]=

This time series is irregularly sampled.

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

Assume TemporalRegularity so that Accumulate does not use interpolation to resample the time series with respect to the minimum time increment.

In[7]:=
Click for copyable input
ts2 = Accumulate[TimeSeries[ts1, TemporalRegularity -> True]]
Out[7]=
In[8]:=
Click for copyable input
DateListStepPlot[ts2, Joined -> False, PlotTheme -> "Detailed"]
Out[8]=

Estimate the PoissonProcess parameter from the signal and compare to the parameter of the ExponentialDistribution used to simulate time stamps.

In[9]:=
Click for copyable input
{FindProcessParameters[ts2, PoissonProcess[\[Mu]]], \[Lambda]}
Out[9]=

Related Examples

de es fr ja ko pt-br ru zh