generate_autoregressive_process_dice

Summary: Generates an AutoRegressive (AR) process with stochastic perturbations determined by a dice-based mechanism. The function models a time series where each value is influenced by its previous value, a deterministic term (alpha), and a stochastic noise term (e_t) that randomly switches sign.

double[]
generate_autoregressive_process_dice
(
double alpha
,
double rho
,
double e_t
,
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.

e_t double

The noise term magnitude, which is added or subtracted randomly based on a dice function.

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] ± e_t where the sign of e_t is randomly determined by the dice(0.5, 0.5) function. - If rho = 0, the process degenerates into a purely stochastic sequence. - If e_t = 0, the process becomes a simple autoregressive model without noise. - The function dynamically appends values to time_series, which may cause memory reallocation. If performance is critical, preallocating the array may be more efficient. - The dice function is assumed to return 1 or 0 with equal probability. - This type of stochastic autoregressive model can be useful in simulating random shocks in economic and financial time series.