# Path: seaborn/_statistics.py
# class KDE:
# class Histogram:
# class ECDF:
# class EstimateAggregator:
#     def __init__(
#         self, *,
#         bw_method=None,
#         bw_adjust=1,
#         gridsize=200,
#         cut=3,
#         clip=None,
#         cumulative=False,
#     ):
#     def _define_support_grid(self, x, bw, cut, clip, gridsize):
#     def _define_support_univariate(self, x, weights):
#     def _define_support_bivariate(self, x1, x2, weights):
#     def define_support(self, x1, x2=None, weights=None, cache=True):
#     def _fit(self, fit_data, weights=None):
#     def _eval_univariate(self, x, weights=None):
#     def _eval_bivariate(self, x1, x2, weights=None):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(
#         self,
#         stat="count",
#         bins="auto",
#         binwidth=None,
#         binrange=None,
#         discrete=False,
#         cumulative=False,
#     ):
#     def _define_bin_edges(self, x, weights, bins, binwidth, binrange, discrete):
#     def define_bin_params(self, x1, x2=None, weights=None, cache=True):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, stat="proportion", complementary=False):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, estimator, errorbar=None, **boot_kws):
#     def __call__(self, data, var):
# def _percentile_interval(data, width):
# def _validate_errorbar_arg(arg):
#     DEFAULT_LEVELS = {
#         "ci": 95,
#         "pi": 95,
#         "se": 1,
#         "sd": 1,
#     }


import numpy as np
import pandas as pd
    import statsmodels.distributions as smdist
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from .._statistics import (
    KDE,
    Histogram,
    ECDF,
    EstimateAggregator,
    _validate_errorbar_arg,
    _no_scipy,
)
        kde2 = KDE(bw_adjust=2)

        d1, _ = kde1(x)
        d2, _ = kde2(x)

        assert np.abs(np.diff(d1)).mean() > np.abs(np.diff(d2)).mean()

    def test_bivariate_grid(self, rng):

        n = 100
        x, y = rng.normal(0, 3, (2, 50))
        kde = KDE(gridsize=n)
        density, (xx, yy) = kde(x, y)

        assert density.shape == (n, n)
        assert xx.size == n
        assert yy.size == n

    def test_bivariate_normalization(self, rng):

        x, y = rng.normal(0, 3, (2, 50))
        kde = KDE(gridsize=100)
        density, (xx, yy) = kde(x, y)

        dx = xx[1] - xx[0]
        dy = yy[1] - yy[0]

        total = density.sum() * (dx * dy)
        assert total == pytest.approx(1, abs=1e-2)


# Path: seaborn/_statistics.py
# class KDE:
# class Histogram:
# class ECDF:
# class EstimateAggregator:
#     def __init__(
#         self, *,
#         bw_method=None,
#         bw_adjust=1,
#         gridsize=200,
#         cut=3,
#         clip=None,
#         cumulative=False,
#     ):
#     def _define_support_grid(self, x, bw, cut, clip, gridsize):
#     def _define_support_univariate(self, x, weights):
#     def _define_support_bivariate(self, x1, x2, weights):
#     def define_support(self, x1, x2=None, weights=None, cache=True):
#     def _fit(self, fit_data, weights=None):
#     def _eval_univariate(self, x, weights=None):
#     def _eval_bivariate(self, x1, x2, weights=None):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(
#         self,
#         stat="count",
#         bins="auto",
#         binwidth=None,
#         binrange=None,
#         discrete=False,
#         cumulative=False,
#     ):
#     def _define_bin_edges(self, x, weights, bins, binwidth, binrange, discrete):
#     def define_bin_params(self, x1, x2=None, weights=None, cache=True):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, stat="proportion", complementary=False):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, estimator, errorbar=None, **boot_kws):
#     def __call__(self, data, var):
# def _percentile_interval(data, width):
# def _validate_errorbar_arg(arg):
#     DEFAULT_LEVELS = {
#         "ci": 95,
#         "pi": 95,
#         "se": 1,
#         "sd": 1,
#     }


# Path: seaborn/tests/test_statistics.py
import numpy as np
import pandas as pd
    import statsmodels.distributions as smdist
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from .._statistics import (
    KDE,
    Histogram,
    ECDF,
    EstimateAggregator,
    _validate_errorbar_arg,
    _no_scipy,
)

        kde2 = KDE(bw_adjust=2)

        d1, _ = kde1(x)
        d2, _ = kde2(x)

        assert np.abs(np.diff(d1)).mean() > np.abs(np.diff(d2)).mean()

    def test_bivariate_grid(self, rng):

        n = 100
        x, y = rng.normal(0, 3, (2, 50))
        kde = KDE(gridsize=n)
        density, (xx, yy) = kde(x, y)

        assert density.shape == (n, n)
        assert xx.size == n
        assert yy.size == n

    def test_bivariate_normalization(self, rng):

        x, y = rng.normal(0, 3, (2, 50))
        kde = KDE(gridsize=100)
        density, (xx, yy) = kde(x, y)

        dx = xx[1] - xx[0]
        dy = yy[1] - yy[0]

        total = density.sum() * (dx * dy)
        assert total == pytest.approx(1, abs=1e-2)


    @pytest.mark.skipif(_no_scipy, reason="Test requires scipy")