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.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_102.png)
SeedRandom["11"];
\[Lambda] = 0.5;
times = RandomVariate[ExponentialDistribution[\[Lambda]], 30];
Create a Databin.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_103.png)
bin = CreateDatabin[]
Use the simulated times to send 1 to the databin in time intervals.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_104.png)
Table[DatabinAdd[bin, <|"arrivals" -> 1|>]; Pause[t], {t, times}];
The recorded signal with the time stamps.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_105.png)
TimeSeries[bin]
![](assets.en/use-databin-to-store-time-series/O_55.png)
Extract the TimeSeries object.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_106.png)
ts1 = TimeSeries[bin]["arrivals"]
![](assets.en/use-databin-to-store-time-series/O_56.png)
This time series is irregularly sampled.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_107.png)
RegularlySampledQ[ts1]
![](assets.en/use-databin-to-store-time-series/O_57.png)
Assume TemporalRegularity so that Accumulate does not use interpolation to resample the time series with respect to the minimum time increment.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_108.png)
ts2 = Accumulate[TimeSeries[ts1, TemporalRegularity -> True]]
![](assets.en/use-databin-to-store-time-series/O_58.png)
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_109.png)
DateListStepPlot[ts2, Joined -> False, PlotTheme -> "Detailed"]
![](assets.en/use-databin-to-store-time-series/O_59.png)
Estimate the PoissonProcess parameter from the signal and compare to the parameter of the ExponentialDistribution used to simulate time stamps.
![Click for copyable input](assets.en/use-databin-to-store-time-series/In_110.png)
{FindProcessParameters[ts2, PoissonProcess[\[Mu]]], \[Lambda]}
![](assets.en/use-databin-to-store-time-series/O_60.png)