def uniform_type_1(a, b, x1, x2): γ = b f = 1 / (γ - a) mean = uniform.mean(a, b - a) var = uniform.var(a, b - a) p = uniform.cdf(x2, a, b - a) - uniform.cdf(x1, a, b - a) return γ, mean, var, p, f, a, b
def uniform_type_2(a, b, x1, x2): γ = (a * b - 1) / a f = a a = γ mean = uniform.mean(a, b - a) var = uniform.var(a, b - a) p = uniform.cdf(x2, a, b - a) - uniform.cdf(x1, a, b - a) return γ, mean, var, p, f, a, b
def uniform_type_4(a, b, x1, x2): γ = 1 / a f = a a = (a * b - 1) / (2 * a) b = a + γ mean = uniform.mean(a, b - a) var = uniform.var(a, b - a) p = uniform.cdf(x2, a, b - a) - uniform.cdf(x1, a, b - a) return γ, mean, var, p, f, a, b
def var(self, dist): return uniform.var(*self._get_params(dist))
# L'appel de la fonction permet de recevoir une version 'frozen' de la PDF rv = uniform() ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf') vals = uniform.ppf([0.001, 0.5, 0.999]) # Return True ou False si les elements sont d'un vecteur sont egaux (a tolerance pres) np.allclose([0.001, 0.5, 0.999], uniform.cdf(vals)) # Retourne des variables aleatoires r = uniform.rvs(size=TAILLE_ECHANTILLON) # Permet d'afficher l'esperance et la variance str_esp_var_emp = "V_EMP = " + str(uniform.var()) ax.plot([], [], "g", label=str_esp_var_emp) # Histogramme ax.hist(r, normed=True, histtype='stepfilled', alpha=0.2) ax.legend(loc='best', frameon=False) # ============================================= # # ============= UNIFORME DISCRETE ============= # # ============================================= # fig, ax = plt.subplots(1, 1) low, high = 7, 31 mean, var, skew, kurt = randint.stats(low, high, moments='mvsk')
def var(self, dist): return uniform.var(*self._get_params(dist))