Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assessing balance with only select columns #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vispz
Copy link

@vispz vispz commented Jun 18, 2020

Context

Sometimes the is_continuous is not precise enough to identify continuous and categorical variables, leading to unwieldy plots. Also sometimes it's useful to only plot the balance on a few specific covariates of interest after matching.

Changes

In order to enable that, I have added a new argument columns: List[str] to the Matcher.compare_continuous and Matcher.compare_categorical methods. When columns is passed in, we do not verify if the column is continuous or categorical but we do remove columns in the self.exclude set.

There is no actual change within the plotting for loops (as indicated below). The changes are simply due to the removal of indentation.

# from
        for col in self.matched_data.columns:
            if uf.is_continuous(col, self.X) and col not in self.exclude:
                do_stuff()

# to
        for col in columns_to_plot:
            do_stuff()

Verification

I ran the example notebook with and without columns and they work as intended. See nbviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant