Commit b7923d9c authored by dsbowen's avatar dsbowen
Browse files

Significance quantile-unbiased (SQU) in development).

parent ca3faf6b
Loading
Loading
Loading
Loading
+107 −9

File changed.

Preview size limit exceeded, changes collapsed.

+31 −8
Original line number Diff line number Diff line
@@ -209,13 +209,21 @@ class RankConditionAnimation:
        self._conventional_vline = ax.axvline(
            self.xlim[0], color=self.palette[1], linestyle="--"
        )
        self._conventional_label = ax.text(self.xlim[0], y_offset, r"$Z_\theta(\theta)$", ha="center")
        self._conventional_label = ax.text(self.xlim[0], y_offset, r"$x$", ha="center")
        # (distribution of conventional estimate line plot, vertical line at conventional point estimate) tuples
        conditional_mean_str = r"$Z_\theta(\theta{0}) + \frac{{\Sigma(\theta{0},\theta)}}{{\Sigma(\theta)}} x$"
        self._distribution_plots = [
            (
                ax.plot([], [], color=self.palette[0])[0],
                ax.axvline(color=self.palette[0], linestyle="--"),
                ax.text(0, y_offset, r"$Z_\theta(\theta{})$".format(i*"'"), ha="center")
                ax.text(
                    0,
                    y_offset,
                    conditional_mean_str.format(
                        i * "'"
                    ),
                    ha="center",
                ),
            )
            for i in range(1, len(self.mean))
        ]
@@ -240,7 +248,8 @@ class QuantileUnbiasedAnimation:
            Defaults to seaborn default palette.
        n_frames (int): Number of frames to animate. Defaults to 120.
    """
    Y_OFFSET = -.07

    Y_OFFSET = -0.07

    def __init__(
        self,
@@ -337,7 +346,13 @@ class QuantileUnbiasedAnimation:
        self._cdf_data.append(cdf)
        self._cdf_plot.set_data(self._x_data, self._cdf_data)

        plots = [self._loc_vline, self._loc_text, self._sf_plot, self._cdf_hline, self._cdf_plot]
        plots = [
            self._loc_vline,
            self._loc_text,
            self._sf_plot,
            self._cdf_hline,
            self._cdf_plot,
        ]
        if self.projection_len is None:
            return plots

@@ -355,7 +370,11 @@ class QuantileUnbiasedAnimation:
        )
        self._projection_lower_text.set_x(loc - self.projection_len)
        self._projection_upper_text.set_x(loc + self.projection_len)
        return plots + [self._projection_plot, self._projection_lower_text, self._projection_upper_text]
        return plots + [
            self._projection_plot,
            self._projection_lower_text,
            self._projection_upper_text,
        ]

    def make_animation(
        self, title: str = None, xlabel: str = None
@@ -401,7 +420,11 @@ class QuantileUnbiasedAnimation:
            self.xlim[0], color=self.palette[3], linestyle="--"
        )
        # text showing the estimator notation
        loc_text = r"$\hat{\mu}_\alpha$" if self.projection_len is None else r"$\hat{\mu}^H_\alpha$"
        loc_text = (
            r"$\hat{\mu}_\alpha$"
            if self.projection_len is None
            else r"$\hat{\mu}^H_\alpha$"
        )
        self._loc_text = ax.text(self.xlim[0], self.Y_OFFSET, loc_text, ha="center")

        # plot of the survival function of the truncated normal
@@ -420,13 +443,13 @@ class QuantileUnbiasedAnimation:
                self.xlim[0] - self.projection_len,
                self.Y_OFFSET,
                loc_text[:-1] + r" - c_\beta \sqrt{\Sigma(\theta)}$",
                ha="center"
                ha="center",
            )
            self._projection_upper_text = ax.text(
                self.xlim[0] + self.projection_len,
                self.Y_OFFSET,
                loc_text[:-1] + r" + c_\beta \sqrt{\Sigma(\theta)}$",
                ha="center"
                ha="center",
            )

        return animation.FuncAnimation(
+2 −2
Original line number Diff line number Diff line
[metadata]
name = conditional-inference
version = 0.0.2
version = 0.0.3
author = Dillon Bowen
author_email = dsbowen@wharton.upenn.edu
description = A statistics package for comparing multiple policies or treatments.
@@ -31,7 +31,7 @@ where = src
[build_sphinx]
project = Conditional Inference
copyright = 2021, Dillon Bowen
release = 0.0.2
release = 0.0.3
source-dir = docs

[coverage:report]
+203 −44

File changed.

Preview size limit exceeded, changes collapsed.

+2 −1
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ class ConventionalEstimatesData:
        ):
            # assume mean is pd.Series-like
            return self.mean_orig.index.to_list()
        return [f"x{i}" for i in range(self.mean.shape[0])]
        zfill = int(np.log10(len(self.mean)))
        return [f"x{str(i).zfill(zfill)}" for i in range(len(self.mean))]

    @exog_names.setter
    def exog_names(
Loading