scipy.stats.sampling.TransformedDensityRejection.
ppf_hat#
- TransformedDensityRejection.ppf_hat(u)#
評估帽子分佈的 CDF 反函數在 u 的值。
- 參數:
- uarray_like
百分位數陣列
- 回傳:
- ppf_hatarray_like
對應給定百分位數的分位數陣列。
範例
>>> from scipy.stats.sampling import TransformedDensityRejection >>> from scipy.stats import norm >>> import numpy as np >>> from math import exp >>> >>> class MyDist: ... def pdf(self, x): ... return exp(-0.5 * x**2) ... def dpdf(self, x): ... return -x * exp(-0.5 * x**2) ... >>> dist = MyDist() >>> rng = TransformedDensityRejection(dist) >>> >>> rng.ppf_hat(0.5) -0.00018050266342393984 >>> norm.ppf(0.5) 0.0 >>> u = np.linspace(0, 1, num=1000) >>> ppf_hat = rng.ppf_hat(u)