Esempio n. 1
0
    def ppf(self, x):
        """
        Computes the percent point function of the distribution at the point(s)
        x. It is defined as the inverse of the CDF. y = ppf(x) can be
        interpreted as the argument y for which the value of the cdf(x) is equal
        to y. Essentially that means the random varable y is the place on the
        distribution the CDF evaluates to x.

        Parameters
        ----------
        x: array, dtype=float, shape=(m x n), bounds=(0,1)
            The value(s) at which the user would like the ppf evaluated.
            If an array is passed in, the ppf is evaluated at every point
            in the array and an array of the same size is returned.

        Returns
        -------
        ppf: array, dtype=float, shape=(m x n)
            The ppf at each point in x.
        """
        vals = np.ceil(pdtrik(x, self.lamb))
        vals1 = vals - 1
        temp = pdtr(vals1, self.lamb)
        ppf = np.where((temp >= x), vals1, vals)

        return ppf
Esempio n. 2
0
    def ppf(self, x):
        """
        Computes the percent point function of the distribution at the point(s)
        x. It is defined as the inverse of the CDF. y = ppf(x) can be
        interpreted as the argument y for which the value of the cdf(x) is equal
        to y. Essentially that means the random varable y is the place on the
        distribution the CDF evaluates to x.

        Parameters
        ----------
        x: array, dtype=float, shape=(m x n), bounds=(0,1)
            The value(s) at which the user would like the ppf evaluated.
            If an array is passed in, the ppf is evaluated at every point
            in the array and an array of the same size is returned.

        Returns
        -------
        ppf: array, dtype=float, shape=(m x n)
            The ppf at each point in x.
        """
        vals = np.ceil(pdtrik(x, self.lamb))
        vals1 = vals - 1
        temp = pdtr(vals1, self.lamb)
        ppf = np.where((temp >= x), vals1, vals)

        return ppf
Esempio n. 3
0
    def quantile(self, *q):
        # check array for numpy structure
        q = check_array(q, reduce_args=True, ensure_1d=True)

        vals = np.ceil(sc.pdtrik(q, self.rate))
        vals1 = np.maximum(vals - 1, 0)
        temp = sc.pdtr(vals1, self.rate)
        return np.where(temp >= q, vals1, vals)
Esempio n. 4
0
    def cdf(self, x):
        """
        Computes the cumulative distribution function of the
        distribution at the point(s) x. The cdf is defined as follows:
            F(x|) =

        Parameters
        ----------
        x: array, dtype=float, shape=(m x n)
            The value(s) at which the user would like the cdf evaluated.
            If an array is passed in, the cdf is evaluated at every point
            in the array and an array of the same size is returned.

        Returns
        -------
        cdf: array, dtype=float, shape=(m x n)
            The cdf at each point in x.
        """
        floored = np.floor(x)
        cdf = pdtr(floored, self.lamb)

        return cdf
Esempio n. 5
0
    def cdf(self, x):
        """
        Computes the cumulative distribution function of the
        distribution at the point(s) x. The cdf is defined as follows:
            F(x|) =

        Parameters
        ----------
        x: array, dtype=float, shape=(m x n)
            The value(s) at which the user would like the cdf evaluated.
            If an array is passed in, the cdf is evaluated at every point
            in the array and an array of the same size is returned.

        Returns
        -------
        cdf: array, dtype=float, shape=(m x n)
            The cdf at each point in x.
        """
        floored = np.floor(x)
        cdf = pdtr(floored, self.lamb)

        return cdf
Esempio n. 6
0
 def _cdf(self, x, mu):
     k = floor(x)
     return special.pdtr(k, mu)
Esempio n. 7
0
 def test(self):
     val = sc.pdtr(0, 1)
     assert_almost_equal(val, np.exp(-1))
Esempio n. 8
0
 def test_domain(self):
     val = sc.pdtr(-1.1, 1.0)
     assert np.isnan(val)
Esempio n. 9
0
 def _cdf(self, x, mu):
     k = np.floor(x)
     return sp.pdtr(k, mu)
 def _cdf(self, x, mu):
     k = floor(x)
     return special.pdtr(k, mu)
Esempio n. 11
0
 def test_m_zero(self):
     val = sc.pdtr([0, 1, 2], 0)
     assert_array_equal(val, [1, 1, 1])
Esempio n. 12
0
 def _ppf(self, q, mu):
     vals = ceil(special.pdtrik(q, mu))
     vals1 = vals-1
     temp = special.pdtr(vals1, mu)
     return np.where((temp >= q), vals1, vals)
Esempio n. 13
0
    def cdf(self, *X):
        # check array for numpy structure
        X = check_array(X, reduce_args=True, ensure_1d=True)

        return sc.pdtr(np.floor(X), self.rate)
Esempio n. 14
0
 def _ppf(self, q, mu):
     vals = ceil(special.pdtrik(q, mu))
     vals1 = np.maximum(vals - 1, 0)
     temp = special.pdtr(vals1, mu)
     return np.where(temp >= q, vals1, vals)
Esempio n. 15
0
 def test_rounding(self):
     double_val = sc.pdtr([0.1, 1.1, 2.1], 1.0)
     int_val = sc.pdtr([0, 1, 2], 1.0)
     assert_array_equal(double_val, int_val)
Esempio n. 16
0
 def _ppf(self, q, mu):
     vals = ceil(special.pdtrik(q, mu))
     vals1 = vals - 1
     temp = special.pdtr(vals1, mu)
     return np.where((temp >= q), vals1, vals)
Esempio n. 17
0
 def test_inf(self):
     val = sc.pdtr(np.inf, 1.0)
     assert_almost_equal(val, 1.0)
 def _ppf(self, q, mu):
     vals = ceil(special.pdtrik(q, mu))
     vals1 = np.maximum(vals - 1, 0)
     temp = special.pdtr(vals1, mu)
     return np.where(temp >= q, vals1, vals)
Esempio n. 19
0
 def ref(self, x, y):
     return special.pdtr(x, y)