ARMA
timecave.data_generation.time_series_functions.arma_ts(number_samples, lags, max_root, ar=True, ma=True, **kwargs)
Generate a time series array based on an Autoregressive Moving Average (ARMA) model.
This function creates a time series array of given length based on an ARMA model with specified parameters such as number of lags and maximum root. It generates samples using an ARMA process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_samples |
int
|
The total number of samples in the time series array. |
required |
lags |
int
|
The number of lags to consider in the ARMA model. |
required |
max_root |
float
|
The maximum root for the ARMA model. This value has to be larger than 1.1. |
required |
ar |
bool
|
Whether to include autoregressive (AR) component in the ARMA model. |
True
|
ma |
bool
|
Whether to include moving average (MA) component in the ARMA model. |
True
|
**kwargs |
dict
|
Additional keyword arguments to pass to the ARMA process generator. See ARMAProcess for more details. |
{}
|
Returns:
| Type | Description |
|---|---|
ndarray
|
A time series array generated based on the specified ARMA model parameters. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the maximum root is not larger than 1.1. |
See also
nonlinear_ar_ts: Generate data from a nonlinear autoregressive process.
Notes
This method of generating synthetic time series data was first proposed by Bergmeir and Benitez (2012). Please refer to [1] for more details on this method.
References
1
Christoph Bergmeir and José M Benítez. On the use of cross-validation for time series predictor evaluation. Information Sciences, 191:192–213, 2012.
Examples:
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from timecave.data_generation.time_series_functions import arma_ts
>>> ts = arma_ts(1000, 5, 2);
>>> _ = plt.plot(np.arange(0, ts.shape[0]), ts);
>>> plt.show();

Pure autoregressive processes can also be generated:
>>> ts2 = arma_ts(1000, 5, 2, ma=False);
>>> _ = plt.plot(np.arange(0, ts2.shape[0]), ts2);
>>> plt.show();

And so can pure moving average processes:
>>> ts3 = arma_ts(1000, 5, 2, ar=False);
>>> _ = plt.plot(np.arange(0, ts3.shape[0]), ts3);
>>> plt.show();

Source code in timecave/data_generation/time_series_functions.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | |