def cdf_to_ppf(self, data, params):
'''
Take the specific distributions fitted parameters and calculate the
cdf. Apply the inverse normal distribution to the cdf to get the SPI
SPEI. This process is best described in Lloyd-Hughes and Saunders, 2002
which is included in the documentation.
'''
# Calculate the CDF of observed precipitation on a given time scale
cdf = self.distr.cdf(
data, *params[:-2], loc=params[-2], scale=params[-1]
)
# Apply inverse normal distribution
norm_ppf = scipy.stats.norm.ppf(cdf)
return norm_ppf
评论列表
文章目录