def __get_tail_sigma(self):
""" Method to produce the sigma of the Mack Chainladder
model tail factor
Returns:
This calculation is consistent with the R calculation
MackChainLadder$tail.sigma
"""
y = np.log(self.sigma[:len(self.triangle.data.columns[:-2])])
x = np.array([i + 1 for i in range(len(y))])
model = stats.linregress(x, y)
tailsigma = np.exp((x[-1] + 1) * model[0] + model[1])
if model[3] > 0.05: # p-vale of slope parameter
y = self.sigma
tailsigma = np.sqrt(
abs(min((y[-1]**4 / y[-2]**2), min(y[-2]**2, y[-1]**2))))
if self.chainladder.tail == True:
time_pd = self.__get_tail_weighted_time_period()
y = np.log(np.append(self.sigma,tailsigma))
x = np.array([i + 1 for i in range(len(y))])
sigma_reg = stats.linregress(x, y)
tailsigma = np.append(tailsigma, np.exp(time_pd * sigma_reg[0] + sigma_reg[1]))
else:
tailsigma = np.append(tailsigma,0)
return tailsigma
评论列表
文章目录