hull_white_simulate

hana_ml.algorithms.pal.tsa.hull_white.hull_white_simulate(data, key=None, endog=None, num_simulation_paths=None, random_seed=None, mean_reversion_speed=None, volatility=None, time_increment=None, confidence_level=None, initial_value=None)

The Hull-White model, as implemented in PAL, is a single-factor interest rate model that plays a crucial role in financial mathematics and risk management. The Hull-White model is particularly significant because it provides a framework for understanding how interest rates evolve over time, which is vital for pricing various financial instruments like bonds and interest rate derivatives. By using this formula, the Hull-White model can simulate various interest rate paths, allowing financial analysts and economists to anticipate changes in the economic landscape and make more informed decisions regarding investment and risk management strategies.

Parameters:
dataDataFrame

Input data which contains two columns, one is ID column, the other is the value of the drift term.

keystr, optional

The ID column.

Defaults to the first column of data if the index column of data is not provided. Otherwise, defaults to the index column of data.

endogstr, optional

The column of series to be tested.

Defaults to the first non-key column.

num_simulation_pathsint, optional

Number of total simulation paths

Defaults to 5000.

random_seedint, optional

Indicates using machine time as seed.

Defaults to 0.

mean_reversion_speedfloat, optional

Alpha in the formula.

Defaults to 0.1.

volatilityfloat, optional

Sigma in the formula.

Defaults to 0.01.

time_incrementfloat, optional

dt in the formula. In daily interest rate modeling, dt might be set to 1/252 (assuming 252 business days in a year), while in monthly modeling, it could be 1/12.

Defaults to 1/252.

confidence_levelfloat, optional

Confidence level that sets the upper and lower bounds of the simulation values.

Defaults to 0.95.

initial_valuefloat, optional

Starting value of the simulation.

Defaults to 0.0.

Returns:
DataFrame

Result, structured as follows:

  • 1st Column, ID, Time step that is monotonically increasing sorted.

  • 2nd Column, MEAN, Mean of the simulation at the corresponding time step.

  • 3rd Column, VARIANCE, Variance of the simulation at the corresponding time step.

  • 4th Column, LOWER_BOUND, Lower bound of the simulation at the corresponding time step with the given confidence level.

  • 5th Column, UPPER_BOUND, Upper bound of the simulation at the corresponding time step with the given confidence level.

Examples

Time series data df:

>>> df.head(3).collect()
    TIME_STAMP  VALUE
0            0  0.075
1            1  0.160
2            2  0.130
......
27          27  0.600
28          28  0.970
29          29  0.830

Perform hull_white_simulate():

>>> result = hull_white_simulate(data=df,
                                 key='TIME_STAMP',
                                 endog='VALUE',
                                 num_simulation_paths=5000,
                                 random_seed=1,
                                 mean_reversion_speed=0.1,
                                 volatility=0.01,
                                 time_increment=0.083,
                                 confidence_level=0.95,
                                 initial_value=0.0)

Outputs:

>>> result.collect()
    ID      MEAN  VARIANCE  LOWER_BOUND  UPPER_BOUND
0    0  0.006255  0.000008     0.000666     0.011843
1    1  0.019503  0.000017     0.011505     0.027502
...
28  28  0.919654  0.000191     0.892594     0.946713
29  29  0.980900  0.000197     0.953388     1.008413