optimize_df_for_students

MonteCarlo.optimize_df_for_students(var_level)

Find degrees of freedom for the t-distribution that best match empirical VaR and CVaR.

The method minimizes the squared error between theoretical and empirical VaR/CVaR using scipy.optimize.minimize_scalar with bounds (2.1, 50).

Parameters:
var_levelint

Confidence level in percent for Value-at-Risk (VaR) and Conditional Value-at-Risk (CVaR). Must be in [1, 99].

Returns:
float

Estimated degrees of freedom for Student’s t-distribution.

Raises:
ValueError

If var_level is outside [1, 99].