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

Rename interaction terms #100

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dsliwka
Copy link
Contributor

@dsliwka dsliwka commented Jan 10, 2024

These are two potential changes:

  • The first one is a small change concerning the default order of variables. Currently the variables are ordered alphabetically as after collecting the variables from different models duplicates are dropped by self.cov_names = sorted(set(covs)) which also causes the variables to be sorted alphabetically. I guess that in most cases users would prefer to keep the coefficient order given by the models as a default order so I adapted the code to drop duplicates without changing the order of coefficients. When I did that I realized that it would be convenient to always move the constant/intercept to the end of the table where it is displayed in most cases in papers.

  • The second one is a small extension of the rename_covariates method. Currently users have to separately rename also interaction terms which are generated automatically when using formulas such as "y~x*z". The extension simply looks up the names of x and z in the cov_map dictionary (when the user uses a dictionary and not a function) & names the interaction term accordingly (preserving Labels when they are used for special formatting) & allows the use to override the interaction symbol.

…ly reordered). This change preserves the order of the coefficients as passed over from the models.
… also rename interaction terms based on the renamed variables that are interacted.
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