{ "cells": [ { "cell_type": "markdown", "id": "ff51ab3d", "metadata": {}, "source": [ "# Assessing Support and Overlap with OverRule\n", "\n", "## Motivation\n", "\n", "When performing backdoor adjustment, even if we correctly specify the causal graph and observe all the relevant variables $X$ for backdoor adjustment, we can only estimate causal effects for individuals with covariates $X$ that satisfy two conditions: \n", "* Support: Simply put, we require that we observe similar individuals in our dataset. For discrete covariates $X$, this can be formalized as requiring that $$P(X) > 0$$\n", "* Overlap: We require that there is some possibility of observing both the treatment and control for similar individuals. Formally, we require that $$1 > P(T = 1 \\mid X) > 0$$\n", "\n", "OverRule [1] is a method for learning Boolean Rule Sets that characterize the set of individuals who satisfy both conditions, and is demonstrated in this notebook on some simple examples to build intuition.\n", "\n", "## Acknowledgements\n", "\n", "Code for OverRule is adapted (with minimal modifications, but some simplifications) from https://github.com/clinicalml/overlap-code, under the MIT License.\n", "\n", "[1] Oberst, M., Johansson, F., Wei, D., Gao, T., Brat, G., Sontag, D., & Varshney, K. (2020). Characterization of\n", "Overlap in Observational Studies. In S. Chiappa & R. Calandra (Eds.), Proceedings of the Twenty Third International\n", "Conference on Artificial Intelligence and Statistics (Vol. 108, pp. 788–798). PMLR. https://arxiv.org/abs/1907.04138" ] }, { "cell_type": "markdown", "id": "7d01b3fd", "metadata": {}, "source": [ "# Table of contents \n", "1. [Illustration on a simple 2D example](#2dexample)\n", " 1. [Problem Data](#2d_problemdata)\n", " 2. [Applying OverRule with default arguments](#2d_applyingOverRule)\n", " 3. [Interpreting the output of OverRule](#2d_interpret_output)\n", " 4. [Configuring OverRule](#2d_configuration)\n", "2. [Illustration on Lalonde and PSID datasets](#lalonde\")" ] }, { "cell_type": "code", "execution_count": 1, "id": "201dfed2", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "import dowhy.datasets\n", "from dowhy import CausalModel\n", "# Functional API\n", "from dowhy.causal_refuters.assess_overlap import assess_support_and_overlap_overrule\n", "\n", "# Data classes to configure ruleset optimization\n", "from dowhy.causal_refuters.assess_overlap_overrule import SupportConfig, OverlapConfig\n", "\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "id": "c1b893ae", "metadata": {}, "source": [ "# Illustration on a simple 2D example \n", "\n", "[Back to Table of Contents](#toc)" ] }, { "cell_type": "markdown", "id": "fc102d2c", "metadata": {}, "source": [ "## Problem Data \n", "[Back to Table of Contents](#toc)\n", "\n", "In this example, we have a pair of binary covariates $X_1, X_2$, with simple violations of the above conditions:\n", "* Support: There are no samples where $X_1 = X_2 = 1$, i.e., $P(X_1 = 1, X_2 = 1) = 0$ \n", "* Overlap: Only individuals with $X_1 = 0, X_2 = 0$ have a chance of recieving both treatment $(T = 1)$ and control $(T = 0)$" ] }, { "cell_type": "code", "execution_count": 2, "id": "71a42a50", "metadata": {}, "outputs": [], "source": [ "test_data = pd.DataFrame(\n", " np.array(\n", " [\n", " [0, 0, 1, 1],\n", " [0, 0, 0, 0],\n", " [0, 1, 1, 0],\n", " [1, 0, 0, 0],\n", " ]\n", " * 50\n", " ),\n", " columns=[\"X1\", \"X2\", \"T\", \"Y\"],\n", " )" ] }, { "cell_type": "markdown", "id": "0c6e3f0b", "metadata": {}, "source": [ "We can visualize these patterns as follows, where we **add some jitter** to the values to makes things easier to see" ] }, { "cell_type": "code", "execution_count": 3, "id": "f9754054", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAAGxCAYAAADxrrYqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAABMm0lEQVR4nO3deXhTZcI28PskTdK0NClQugBFllIQQXFAallksbQKoqgzg6MCgwijAirVUeoCoqPFHRVGXhh9HUWF0Rc3YKhQrAwKMhb4xIWllB1altKkpGmTNuf74zRp0mZrmzRpz/27rl7Qk3OS59DQO88uiKIogoiISKYUoS4AERFRK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u3bsjNzQUATJo0Ca+99hquvvpqpKWloaioCE8//TQmTZrkCEQiIqJACmoQTpkyBefOncPChQtRUlKCwYMHY9OmTY4BNMePH3epAT711FMQBAFPPfUUTp06hS5dumDSpEl4/vnng1lMIiKSMUFsZ22ORqMRer0eBoMBOp0u1MUhIqIQ8TcPwmrUKBERUWtjEBIRkawxCImISNYYhEREJGsMQiIikjUGIRERyRqDkIiIZI1BSEREssYgJCIiWWMQEhGRrDEIiYhI1hiEREQkawxCIiKSNQYhERHJGoOQiIhkjUFIRESyxiAkIiJZYxASEZGsMQiJiEjWGIRERCRrDEIiIpI1BiEREckag5CIiGSNQUhERLLGICQiIlljEBIRkawxCImISNYYhEREJGsMQiIikjUGIRERyRqDkIiIZI1BSEREssYgJCIiWWMQEhGRrDEIiYhI1hiEREQkawxCIiKSNQYhERHJGoOQiIhkjUFIRESyxiAkIiJZC3oQLl++HD179kRkZCTS0tKwa9cur+eXl5djzpw5SEpKgkajQWpqKjZu3BjsYhIRkUxFBPPJ165di+zsbKxYsQJpaWlYunQpsrKycODAAcTHxzc632KxYPz48YiPj8enn36Kbt264dixY4iNjQ1mMYmISMYEURTFYD15WloarrnmGixbtgwAYLPZkJycjHnz5mHBggWNzl+xYgVefvll7N+/HyqVqlmvaTQaodfrYTAYoNPpWlR+IiJqu/zNg6A1jVosFhQWFiIjI6P+xRQKZGRkYMeOHW6v+fLLL5Geno45c+YgISEBAwcOxAsvvIDa2tpgFZOIiGQuaE2j58+fR21tLRISElyOJyQkYP/+/W6vKS4uxtatW3HXXXdh48aNKCoqwgMPPACr1YpFixa5vaa6uhrV1dWO741GY+BugoiI2r2wGjVqs9kQHx+PlStXYsiQIZgyZQqefPJJrFixwuM1ubm50Ov1jq/k5ORWLDEREbV1QQvCuLg4KJVKlJaWuhwvLS1FYmKi22uSkpKQmpoKpVLpOHb55ZejpKQEFovF7TU5OTkwGAyOrxMnTgTuJoiIqN0LWhCq1WoMGTIE+fn5jmM2mw35+flIT093e82IESNQVFQ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iBoqIiR8gDwMGDB5GUlBSWIQg07z4rKysbhZ09/MV2tKRzW/wd5FOoR+vI3Zo1a0SNRiO+99574q+//irOnj1bjI2NFUtKSkRRFMWpU6eKCxYscJz/3XffiREREeIrr7wi/vbbb+KiRYvazPSJptznkiVLRLVaLX766afimTNnHF8VFRWhugW/NPU+G2oLo0abeo/Hjx8XY2JixLlz54oHDhwQ169fL8bHx4t/+9vfQnULfmnqfS5atEiMiYkRP/74Y7G4uFj8+uuvxT59+oh//OMfQ3ULfqmoqBD37Nkj7tmzRwQgvvbaa+KePXvEY8eOiaIoigsWLBCnTp3qON8+feKvf/2r+Ntvv4nLly/n9Alqubfeekvs0aOHqFarxWHDhok7d+50PDZ69Ghx+vTpLuf/61//ElNTU0W1Wi1eccUV4oYNG1q5xM3TlPu87LLLRACNvhYtWtT6BW+ipv48nbWFIBTFpt/j999/L6alpYkajUbs3bu3+Pzzz4s1NTWtXOqma8p9Wq1W8ZlnnhH79OkjRkZGisnJyeIDDzwgXrx4sfUL3gTffPON2/9r9nubPn26OHr06EbXDB48WFSr1WLv3r3F//3f/231cgcSt2EiIiJZYx8hERHJGoOQiIhkjUFIRESyxiAkIiJZYxASEZGsMQiJiEjWGIRERCRrDEIiIpI1BiEREckag5CIiGSNQUhERLLGICQiIln7/xu2ijJtmn3vAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "rng = np.random.default_rng(0)\n", "jitter_data = test_data.copy()\n", "jitter_data['X1'] = jitter_data['X1'] + rng.normal(0, 0.05, size=(200,)) \n", "jitter_data['X2'] = jitter_data['X2'] + rng.normal(0, 0.05, size=(200,)) \n", "\n", "fig, ax = plt.subplots(1, 1, figsize=(5, 5))\n", "for t in [0, 1]:\n", " this_data = jitter_data.query('T == @t')\n", " ax.scatter(this_data['X1'], this_data['X2'], label=f'T = {t}', edgecolor='w', linewidths=0.5)\n", "\n", "plt.legend()\n", "plt.show()" ] }, { "cell_type": "markdown", "id": "11abab7e", "metadata": {}, "source": [ "Notice how the only region where overlap holds is when $X_1 = X_2 = 0$." ] }, { "cell_type": "markdown", "id": "6a5d5c53", "metadata": {}, "source": [ "## Applying OverRule with default arguments \n", "[Back to Table of Contents](#toc)" ] }, { "cell_type": "markdown", "id": "aa1618d9", "metadata": {}, "source": [ "This method is currently implemented as a refutation method, though it can also be accessed through the functional API. We illustrate both methods below, before discussing their arguments.\n", "\n", "Note that OverRule returns rules in Disjunctive Normal Form (DNF), which can be read as an OR of ANDs, and are given when `print(refute)` is called." ] }, { "cell_type": "markdown", "id": "2e165ecb", "metadata": {}, "source": [ "### Example usage using CausalModel" ] }, { "cell_type": "code", "execution_count": 4, "id": "cb218c53", "metadata": {}, "outputs": [], "source": [ "model = CausalModel(\n", " data=test_data,\n", " treatment=\"T\",\n", " outcome=\"Y\",\n", " common_causes=['X1', 'X2']\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "id": "d1b9d144", "metadata": {}, "outputs": [], "source": [ "identified_estimand = model.identify_effect(proceed_when_unidentifiable=True)\n", "\n", "estimate = model.estimate_effect(identified_estimand, method_name=\"backdoor.linear_regression\")" ] }, { "cell_type": "code", "execution_count": 6, "id": "8b0e895d", "metadata": {}, "outputs": [], "source": [ "# We disucss configuration in more depth below.\n", "support_config = SupportConfig(seed=0)\n", "overlap_config = OverlapConfig()" ] }, { "cell_type": "code", "execution_count": 7, "id": "e6afb904", "metadata": {}, "outputs": [], "source": [ "refute = model.refute_estimate(\n", " identified_estimand, \n", " estimate, \n", " method_name='assess_overlap', \n", " support_config=support_config, \n", " overlap_config=overlap_config,\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "id": "e11e8d3b", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rules cover 50.0% of all samples\n", "Overall, 50.0% of samples meet the criteria for inclusion in the overlap set, \n", "defined as (a) being covered by support rules and having propensity\n", "score in (0.10, 0.90)\n", "Rules capture 100.0% of samples which meet these criteria\n", "\n", "How to read rules: The following rules are given in Disjuntive Normal Form, \n", "a series of AND clauses (e.g., X and Y and Z) joined by ORs. Hence, if a sample \n", " satifies any of the clauses for the support rules, it is included in the support, \n", "and likewise for the overlap rules.\n", "\n", "DETAILED RULES:\n", "SUPPORT Rules: Found 2 rule(s), covering 100.0% of samples\n", "\t Rule #0: (not X1)\n", "\t\t [Covers 75.0% of samples]\n", "\t OR Rule #1: (X1)\n", "\t\t AND (not X2)\n", "\t\t [Covers 25.0% of samples]\n", "OVERLAP Rules: Found 1 rule(s), covering 50.0% of samples\n", "\t Rule #0: (not X1)\n", "\t\t AND (not X2)\n", "\t\t [Covers 50.0% of samples]\n", "\n" ] } ], "source": [ "print(refute)" ] }, { "cell_type": "markdown", "id": "3dee0fdd", "metadata": {}, "source": [ "### Example usage using the Functional API\n", "\n" ] }, { "cell_type": "markdown", "id": "91ff2447", "metadata": {}, "source": [ "Note that the outcome $Y$ is not used as part of OverRule, so it is not required here." ] }, { "cell_type": "code", "execution_count": 9, "id": "3ac5e83e", "metadata": {}, "outputs": [], "source": [ "refute = assess_support_and_overlap_overrule(\n", " data=test_data, \n", " backdoor_vars=['X1', 'X2'], \n", " treatment_name='T', \n", " support_config=support_config, \n", " overlap_config=overlap_config\n", ")" ] }, { "cell_type": "markdown", "id": "bbf343e9", "metadata": {}, "source": [ "### Only fitting support or overlap rules\n", "\n", "You can also run OverRule to **only** learn either support or overlap rules, by passing in either `support_only=True` or `overlap_only=True`." ] }, { "cell_type": "code", "execution_count": 10, "id": "176bc2a1", "metadata": {}, "outputs": [], "source": [ "refute = model.refute_estimate(\n", " identified_estimand, \n", " estimate, \n", " method_name='assess_overlap', \n", " support_only=True,\n", " support_config=support_config,\n", ")" ] }, { "cell_type": "code", "execution_count": 11, "id": "77d12a88", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rules cover 100.0% of all samples\n", "\n", "How to read rules: The following rules are given in Disjuntive Normal Form, \n", "a series of AND clauses (e.g., X and Y and Z) joined by ORs. Hence, if a sample \n", " satifies any of the clauses for the support rules, it is included in the support, \n", "and likewise for the overlap rules.\n", "\n", "DETAILED RULES:\n", "SUPPORT Rules: Found 2 rule(s), covering 100.0% of samples\n", "\t Rule #0: (not X1)\n", "\t\t [Covers 75.0% of samples]\n", "\t OR Rule #1: (X1)\n", "\t\t AND (not X2)\n", "\t\t [Covers 25.0% of samples]\n", "No Overlap Rules Fitted (support_only=True).\n" ] } ], "source": [ "print(refute)" ] }, { "cell_type": "code", "execution_count": 12, "id": "add58e8f", "metadata": {}, "outputs": [], "source": [ "refute = model.refute_estimate(\n", " identified_estimand, \n", " estimate,\n", " method_name='assess_overlap', \n", " overlap_only=True, \n", " overlap_config=overlap_config\n", ")" ] }, { "cell_type": "code", "execution_count": 13, "id": "f43178ac", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rules cover 50.0% of all samples\n", "Overall, 50.0% of samples meet the criteria for inclusion in the overlap set, \n", "defined as (a) being covered by support rules and having propensity\n", "score in (0.10, 0.90)\n", "Rules capture 100.0% of samples which meet these criteria\n", "\n", "How to read rules: The following rules are given in Disjuntive Normal Form, \n", "a series of AND clauses (e.g., X and Y and Z) joined by ORs. Hence, if a sample \n", " satifies any of the clauses for the support rules, it is included in the support, \n", "and likewise for the overlap rules.\n", "\n", "DETAILED RULES:\n", "No Support Rules Fitted (overlap_only=True).\n", "OVERLAP Rules: Found 1 rule(s), covering 50.0% of samples\n", "\t Rule #0: (not X1)\n", "\t\t AND (not X2)\n", "\t\t [Covers 50.0% of samples]\n", "\n" ] } ], "source": [ "print(refute)" ] }, { "cell_type": "markdown", "id": "ac98cce5", "metadata": {}, "source": [ "## Interpreting the output of OverRule \n", "[Back to Table of Contents](#toc)\n", "\n", "We will use the following set of rules to illustrate how to interpret the output.\n", "\n", "```\n", "SUPPORT Rules: Found 2 rule(s), covering 100.0% of samples\n", "\t Rule #0: (not X1)\n", " [Covers 75.0% of samples]\n", "\t OR Rule #1: (X1)\n", " AND (not X2)\n", " [Covers 25.0% of samples]\n", "OVERLAP Rules: Found 1 rule(s), covering 50.0% of samples\n", "\t Rule #0: (not X2)\n", " AND (not X1)\n", " [Covers 50.0% of samples]\n", "```\n", "\n", "For any sample, we can check if the sample is covered by the support by checking each rule (Rule 0 and Rule 1). The sample is in the support if ANY of these rules apply. Consider a point (X1 = 1, X2 = 1), which we know is not in the support of our original data. Since each binary input is treated as a boolean, we can check:\n", "* Rule 0: (not X1) --> This rule is not satisfied by (X1 = 1, X2 = 1), because X1 = 1 is equivalent to X2 = True\n", "* Rule 1: (X1) AND (not X2) --> This rule is not satisfied, because X2 = 1\n", "\n", "Similarly, we can check if a sample is covered by the overlap rules. Consider the point (X1 = 1, X2 = 0). This satisfies the support rules because it matches Rule 0. For the overlap rules, however, we can check:\n", "* Rule 0: (not X2) AND (not X1) --> This rule is not satisfied, because X1 = 1.\n", "\n", "**Note**: When we later filter samples based on the rules learned by OverRule, we will filter out any samples that do not match BOTH a support rule, and an overlap rule." ] }, { "cell_type": "markdown", "id": "cdc74f44", "metadata": {}, "source": [ "## Configuring OverRule \n", "[Back to Table of Contents](#toc)\n", "\n", "OverRule can be configured by passing in the following arguments\n", "* `overlap_eps`: This should be a number $\\epsilon$ in (0, 0.5) which defines the overlap region as those points where $P(T = 1 \\mid X)$ is in $(\\epsilon, 1 - \\epsilon)$.\n", "\n", "* `cat_feats`: A list of any categorical features (automatically inferred if dtype is object).\n", "\n", "* `support_config`: A `SupportConfig` (see below), which controls optimization parameters\n", "\n", "* `overlap_config`: An `OverlapConfig` (see below), which controls optimization parameters" ] }, { "cell_type": "code", "execution_count": 14, "id": "cc8734c5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SupportConfig(n_ref_multiplier=1.0, seed=None, alpha=0.98, lambda0=0.01, lambda1=0.001, K=20, D=20, B=10, iterMax=10, num_thresh=9, thresh_override=None, solver='ECOS', rounding='greedy_sweep')\n" ] } ], "source": [ "support_config = SupportConfig()\n", "print(support_config)" ] }, { "cell_type": "code", "execution_count": 15, "id": "68fda6d1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OverlapConfig(alpha=0.95, lambda0=0.001, lambda1=0.001, K=20, D=20, B=10, iterMax=10, num_thresh=9, thresh_override=None, solver='ECOS', rounding='greedy_sweep')\n" ] } ], "source": [ "overlap_config = OverlapConfig()\n", "print(overlap_config)" ] }, { "cell_type": "markdown", "id": "374ec6b5", "metadata": {}, "source": [ "**Key Parameters**: For `SupportConfig` and `OverlapConfig`, the defaults are generally sensible, but some may be worth changing depending on the problem, and are detailed below." ] }, { "cell_type": "markdown", "id": "bb2a9a2c", "metadata": {}, "source": [ "* `alpha`: \n", " + For learning support rules, we require that at least an `alpha` fraction of the original data is included, while minimizing the volume of the resulting support set. \n", " + For learning overlap rules, at least an `alpha` fraction of the \"overlap points\" must be included, while excluding as many non-overlap points as possible. Here, the \"overlap points\" are defined as those where $P(T = 1 \\mid X)$ is within `[overlap_eps, 1 - overlap_eps]`, estimated using an XGBClassifier.\n", "* `lambda0`, `lambda1`: These are regularization terms which control the complexity of the final rules. \n", " + `lambda0` is a penalty added for every new rule (which can contain multiple literals). For instance, `(not X1) AND (not X2)` is a single rule. \n", " + `lambda1` is a penalty added for every literal. For instance, `(not X1) AND (not X2)` contains two literals.\n", "* `num_thresh`: OverRule turns all features into binary rules before learning rulesets. For continuous variables, it does so (by default) by converting into deciles. This default behavior can be changed via changing the number of thresholds, or specifying a dictionary (in `thresh_override`) that maps features to a `np.ndarray` of thresholds." ] }, { "cell_type": "markdown", "id": "8861fb8c", "metadata": {}, "source": [ "# Illustration on Lalonde and PSID datasets \n", "[Back to Table of Contents](#toc)" ] }, { "cell_type": "markdown", "id": "ce6eb962", "metadata": {}, "source": [ "In this section, we show how OverRule can be applied in the course of doing another causal analysis. Here, we demonstrate both\n", "* Using OverRule prior to conducting analysis\n", "* Filtering samples using the learned rules\n", "\n", "Incorporating OverRule into a causal inference workflow looks like\n", "* First, applying OverRule to learn rules, before any causal effect estimation is performed\n", "* Second, filtering samples according to the learned rules\n", "* Third, estimating causal effects on the filtered sample" ] }, { "cell_type": "markdown", "id": "d2dff2a8", "metadata": {}, "source": [ "For this illustration, we use two datasets to construct a somewhat artificial causal inference task:\n", "* The original dataset from Lalonde (1986), which contains experimental samples, and which is loaded via `dowhy.datasets.lalonde_dataset()`. Because this is an *experimental* sample, we will see that **overlap holds for all the samples in this sample.**\n", "* An observational dataset consisting entirely of non-treated samples, the PSID dataset, which was analyzed in Smith & Todd (2005) in conjunction with the original experimental dataset. This is loaded from `dowhy.datasets.psid_dataset()`\n", "\n", "By merging these datasets and then assessing overlap, we find that **in the combined dataset, overlap only holds for ~30% of samples.** Intuitively, many of the samples from the PSID are excluded, due to the restrictive inclusion criteria on the original experiment." ] }, { "cell_type": "code", "execution_count": 48, "id": "97cda5fa", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "import dowhy.datasets\n", "from dowhy.causal_refuters.assess_overlap import assess_support_and_overlap_overrule\n", "from dowhy.causal_refuters.assess_overlap_overrule import OverlapConfig, SupportConfig\n", "\n", "# Experimental sample from Lalonde\n", "experiment_data = dowhy.datasets.lalonde_dataset()\n", "\n", "# Observational sample\n", "observational_controls = dowhy.datasets.psid_dataset()\n", "\n", "experiment_data[\"exp_samp\"] = True\n", "observational_controls[\"exp_samp\"] = False\n", "\n", "data = pd.concat([experiment_data, observational_controls], axis=0, ignore_index=True)\n", "\n", "support_config = SupportConfig(seed=0, lambda0=0.01, lambda1=0.01)\n", "overlap_config = OverlapConfig(lambda0=0.01, lambda1=0.01)" ] }, { "cell_type": "markdown", "id": "51a00dcc", "metadata": {}, "source": [ "Before running any causal analysis, we first check for support and overlap. Note that the default setting for `alpha` is 0.98, which means that \n", "* The support rules will try to cover at least 98% (`alpha`) of the data with a minimum volume set\n", "* The overlap rules will try to cover at least 98% (`alpha`) of the samples which have propensity scores in `[overlap_eps, 1-overlap_eps]`" ] }, { "cell_type": "markdown", "id": "d67ae8a7", "metadata": {}, "source": [ "## Checking for Support/Overlap in the Experimental Sample" ] }, { "cell_type": "code", "execution_count": 17, "id": "867c6981", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "All samples in the support region satisfy the overlap condition.\n", "No Overlap Rules will be learned.\n", "Rules cover 98.9% of all samples\n", "\n", "How to read rules: The following rules are given in Disjuntive Normal Form, \n", "a series of AND clauses (e.g., X and Y and Z) joined by ORs. Hence, if a sample \n", " satifies any of the clauses for the support rules, it is included in the support, \n", "and likewise for the overlap rules.\n", "\n", "DETAILED RULES:\n", "SUPPORT Rules: Found 4 rule(s), covering 98.9% of samples\n", "\t Rule #0: ([re74 <= 0.000])\n", "\t\t [Covers 73.3% of samples]\n", "\t OR Rule #1: (black)\n", "\t\t AND (not hisp)\n", "\t\t AND ([age <= 35.000])\n", "\t\t AND ([educ <= 12.000])\n", "\t\t [Covers 71.5% of samples]\n", "\t OR Rule #2: (not married)\n", "\t\t AND ([re74 <= 7838.192])\n", "\t\t AND ([re75 <= 5146.040])\n", "\t\t [Covers 73.7% of samples]\n", "\t OR Rule #3: (not black)\n", "\t\t AND ([age <= 30.000])\n", "\t\t AND ([educ <= 12.000])\n", "\t\t AND ([educ > 8.000])\n", "\t\t [Covers 10.6% of samples]\n", "No Overlap Rules Fitted (support_only=True).\n" ] } ], "source": [ "refute_experiment = assess_support_and_overlap_overrule(\n", " data=experiment_data,\n", " backdoor_vars=\"nodegr+black+hisp+age+educ+married+re74+re75\".split(\"+\"),\n", " treatment_name=\"treat\",\n", " support_config=support_config,\n", " overlap_config=overlap_config,\n", ")\n", "\n", "# Observe how everyone is in the overlap set, so we do not learn any overlap rules\n", "print(refute_experiment)" ] }, { "cell_type": "markdown", "id": "5faf90a0", "metadata": {}, "source": [ "**Note**: As demonstrated above, if OverRule finds that all samples satisfy the overlap condition, then it will not bother to learn separate Overlap rules." ] }, { "cell_type": "markdown", "id": "9af5d792", "metadata": {}, "source": [ "## Assessing Support/Overlap on the combined sample" ] }, { "cell_type": "markdown", "id": "060f1bdd", "metadata": {}, "source": [ "Now, analyzing the combined dataset, we find a substantial lack of overlap" ] }, { "cell_type": "code", "execution_count": 18, "id": "a7aa4ab7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rules cover 34.6% of all samples\n", "Overall, 31.2% of samples meet the criteria for inclusion in the overlap set, \n", "defined as (a) being covered by support rules and having propensity\n", "score in (0.10, 0.90)\n", "Rules capture 96.8% of samples which meet these criteria\n", "\n", "How to read rules: The following rules are given in Disjuntive Normal Form, \n", "a series of AND clauses (e.g., X and Y and Z) joined by ORs. Hence, if a sample \n", " satifies any of the clauses for the support rules, it is included in the support, \n", "and likewise for the overlap rules.\n", "\n", "DETAILED RULES:\n", "SUPPORT Rules: Found 2 rule(s), covering 98.1% of samples\n", "\t Rule #0: ([re74 <= 33307.536])\n", "\t\t AND ([re75 <= 32691.290])\n", "\t\t [Covers 87.6% of samples]\n", "\t OR Rule #1: (not nodegr)\n", "\t\t AND (not hisp)\n", "\t\t AND ([educ > 11.000])\n", "\t\t [Covers 60.6% of samples]\n", "OVERLAP Rules: Found 5 rule(s), covering 35.3% of samples\n", "\t Rule #0: ([re74 <= 1282.723])\n", "\t\t [Covers 20.0% of samples]\n", "\t OR Rule #1: ([re75 <= 716.129])\n", "\t\t [Covers 20.1% of samples]\n", "\t OR Rule #2: (black)\n", "\t\t AND (not married)\n", "\t\t [Covers 15.2% of samples]\n", "\t OR Rule #3: (not nodegr)\n", "\t\t AND ([re74 <= 7837.067])\n", "\t\t [Covers 12.2% of samples]\n", "\t OR Rule #4: ([age <= 26.000])\n", "\t\t AND ([educ > 11.000])\n", "\t\t AND ([re75 <= 11637.097])\n", "\t\t [Covers 7.7% of samples]\n", "\n" ] } ], "source": [ "var_list = \"nodegr+black+hisp+age+educ+married+re74+re75\".split(\"+\")\n", "refute = assess_support_and_overlap_overrule(\n", " data=data,\n", " backdoor_vars=var_list,\n", " treatment_name=\"treat\",\n", " support_config=support_config,\n", " overlap_config=overlap_config,\n", ")\n", "print(refute)" ] }, { "cell_type": "markdown", "id": "e02a1e30", "metadata": {}, "source": [ "## Filtering with OverRule before performing a causal analysis" ] }, { "cell_type": "markdown", "id": "6058d9df", "metadata": {}, "source": [ "OverRule can take any dataframe with the same columns as the original dataframe, and filter down to units that are included in both the support and overlap region." ] }, { "cell_type": "code", "execution_count": 56, "id": "6821c80e", "metadata": {}, "outputs": [], "source": [ "bool_mask = refute.predict_overlap_support(data)\n", "\n", "# This is a simple wrapper around refute.predict_overlap_support\n", "filtered_df = refute.filter_dataframe(data).copy()\n", "\n", "assert np.array_equal(data[bool_mask], filtered_df)" ] }, { "cell_type": "code", "execution_count": 47, "id": "acf86d4d", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAKsAAAAPCAYAAACbZT/hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHZUlEQVRoBeWa25EVOQxAe6kJYGAjADLgkcGQwbJEAGTAFl/wR0EGQAQ8MgAi4JEBbATAZDB7jq9l7G7f22742dpVlce2JEuyJMvuC9PZ2dn0b2wPHjy4MrcL3DHt0hz/X5r/H/dtTGl3aMeHYnk0VfDw4cPHefqV/jLtMbgvFcveIXyXIN7NDMf0zl3/NuO6HfQrEO7Sx9rgewdOOZ8ywrFwddft/mae+xVOvlfgF3rBadNfmfca/Tfn4ENHJu068OGPwL+oebfIy7yxx0P+Gdp3GFTZeDBm8D2NNfQXaLfBnVa4ifnmGLLmoI+UD8+abnNAnqfw0i3gFPz5kqxMPsLyiP61rPQ69CP9DdrBhM28Bj2CMTH+g/Vv6G/SkkzlduAVuF6ymEiCG1G/MrSvcTA4D0TRy3xibrIe04pexgZCZ9yQR2Cso2OPJbkzr3a5p4Snd27zEE+ZZ1Sevhz1z+i+tWE1ZvCkOKJfW59k2/Xp38yv0lJsM9+ojRP8+nPNR0O6kXOdpp97eXYCPhWYlKwovgNiHlyz2WCb8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eusZHP6nb93BP9nSkQBr09joQAcQp6i7esaRNpSsFOfHuC9IHBp7ok0w7pj8oy4Xw+MHkm+uq8w6EXTreQBRgjZXSKvuZpm4d3gB0D43y66/7iXn4wgDvg3RQauI+ecEDfdU/8Gr30L4rO8MPoco+cMXP8oM3CQqAi2s28TEftXGTj0Z0F6N2A2/EYntNO5cncX3WNMdRWRclecboifLKD0fNyGlqkK/DY6UtDZxOMpnFhQOtXj1ZyR74vKqkm/wGogFwbtYkDfsLHZrOuExfKirjUq2hudee7pDROHJAnutG/CPf6r5lyvCrMdPv/goQ/hu1UfWbfJTtrbu57kTDFv1unoRN9ZrpKM98a0Wi1AxWNhOju7hilF5vPEg6XwjaIumR/T3TS/Iwfwa+fNwoIIOVMsnQptxMtCaBMq8bb/TBp5M8MHPZJnC8UX0e6I856At1FpmD8pSz6p+sbHXfmc9uKGbY6N78cf4i4xRHen2jL+uba9RGlqWn3KqPNuhWphD50n3mpMqKUAP1LQtPq/KG/mSSHskixdHOaJ7CGgy+V1gBeHSSTvGDKjmpENuBPLYa/KfB5m3LPP61q05qx+VNHALg9Zr356uSxIw9sTrYPST50YMrNoKzInu4yuFlrH1zXwzJY50w6p/RfU/YNBQzdGvnPPj6wT3Xz7ZRG9U95KMNumFNEHlwGoi6/83/5SJggIwGSMavtOu0R+DrDcnnW9Bgzt9AntQ6kXSS/wJRKhHzAuBNRnlcJ+iA9+Djy1xaVECvcx3uh1SzEeZWy/uZTpfABG70MtduZfbA26OuMhNzfaFPBPU3vvgJeUP+Qe7QvjUK3tGYxcGL/Sz8k+UN2SivgP6DPqp4HB7UnXndu4Ww+xPhPz4Vghy51fgMAAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle 0.345826235093697$" ], "text/plain": [ "0.34582623509369675" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bool_mask.mean()" ] }, { "cell_type": "markdown", "id": "2364ad4c", "metadata": {}, "source": [ "## Performing causal inference after filtering\n", "\n", "Suppose that we were only given the combined sample, and wanted to perform causal effect estimation. Having used OverRule to characterize the Support/Overlap region, we can now filter the data and perform analysis on the reduced dataset." ] }, { "cell_type": "code", "execution_count": 43, "id": "1500a720", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Causal Estimate is -958.9002273474416\n" ] } ], "source": [ "# Note that we are using the filtered_df here\n", "model = CausalModel(\n", " data = filtered_df,\n", " treatment='treat',\n", " outcome='re78',\n", " common_causes=\"nodegr+black+hisp+age+educ+married+re74+re75\".split(\"+\")\n", ")\n", "identified_estimand = model.identify_effect(proceed_when_unidentifiable=True)\n", "\n", "estimate = model.estimate_effect(identified_estimand,\n", " method_name=\"backdoor.propensity_score_weighting\",\n", " target_units=\"ate\", \n", " method_params={\"weighting_scheme\":\"ips_weight\"})\n", "\n", "print(\"Causal Estimate is \" + str(estimate.value))" ] }, { "cell_type": "markdown", "id": "a7376c23", "metadata": {}, "source": [ "**Disclaimer**: This is just an illustration of how to incorporate OverRule into a causal inference workflow. However, the task itself is somewhat artificial: Here, we have combined experimental data (from Lalonde) with observational data (from PSID), which can introduce bias into our estimates. We only do so here to demonstrate that OverRule can pick up on a lack of overlap between treatment and control in the combined sample." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }