generate_autoregressive_process

Summary: Generates an AutoRegressive (AR) process of order 1 (AR(1)). The function models a time series where each value is influenced by the previous value, a deterministic term (alpha), and a random noise component.

double[]
generate_autoregressive_process
(
double alpha
,
double rho
,
int n
)

Parameters

alpha double

The base level constant that shifts the series.

rho double

The autoregressive coefficient determining the influence of the previous value on the current value.

n int

The number of samples to generate in the autoregressive process.

Return Value

Type: double[]

result: A double array containing n samples of the generated autoregressive process.

Notes: - The process is defined as: yi = alpha + rho * y[i-1] + noisei where noise[i] is drawn from a uniform distribution in the range [-1.0, 1.0]. - If rho = 0, the process degenerates into white noise. - If alpha = 0, the process remains centered around zero unless rho > 1, which would make it non-stationary. - Uses Random(unpredictableSeed) for randomness, ensuring different sequences in each execution. - The function dynamically appends values to time_series, which may cause memory reallocation. If performance is critical, preallocating the array may be more efficient. - AR models are commonly used in time series forecasting and financial modeling to capture short-term dependencies in data.