In the heterogeneity function, "AR" function is being used but this has now been replaced with statsmodels.tsa.ar_model.AutoReg. Thanks to update
I'm no expert but I have suggested fix as follows:
from statsmodels.tsa.ar_model import AutoReg
...
try:
x_whitened = AutoReg(x, lags=order_ar, trend='c').fit().resid
except:
try:
x_whitened = AutoReg(x, lags=order_ar, trend='n').fit().resid
except:
output = {
'arch_acf': np.nan,
'garch_acf': np.nan,
'arch_r2': np.nan,
'garch_r2': np.nan
}
return output