vincentarelbundock / marginaleffects

R package to compute and plot predictions, slopes, marginal means, and comparisons (contrasts, risk ratios, odds, etc.) for over 100 classes of statistical and ML models. Conduct linear and non-linear hypothesis tests, or equivalence tests. Calculate uncertainty estimates using the delta method, bootstrapping, or simulation-based inference
https://marginaleffects.com
Other
430 stars 45 forks source link

Rename arguments #675

Closed vincentarelbundock closed 1 year ago

vincentarelbundock commented 1 year ago

I want to move to 1.0.0 in the medium run, so this is starting to be close to the last chance to make some changes to the argument names. Of course, any change will preserve older arguments as aliases for backward compatibility.

Potential renames:

vincentarelbundock commented 1 year ago

@ngreifer What do you think about this?

I've never liked transform_pre since it feels opaque. Also, it's only used in comparisons() and the parallel to transform_post isn't clear.

Would also be similar to hypotheses(x, hypothesis = ...)

vincentarelbundock commented 1 year ago

I can't come up with a good alternative for transform_pre. The current version is not great, but at least it tells us when things happen.

transform_post is long, but it's also nice to be explicit about the timing.

Since I can't think of excellent alternatives, there's no point in changing things just to change things.

ngreifer commented 1 year ago

In clarify, I use the name contrast to specify the contrast. In the causal inference literature, this is the language used. I am a fan of contrast/comparison and transform. I think transform_pre isn't a great name for avg_comparisons() because the transformation occurs after the average predictions have been calculated, which I think is different from comparisons(), where it occurs before any averaging (i.e., done by summary()).

Sorry it took so long for me to see this.

vincentarelbundock commented 1 year ago

Cool, thanks. I agree. Changed and merged.

I used comparison because I think that in some contexts contrast specifically means a linear combination which sums to 1. "Comparison" seems more generic, allowing for ratios, etc.

ngreifer commented 1 year ago

I agree. Again, it's a field-specific language thing (i.e., the idea of a "causal contrast" as more general than an average treatment effect). I know in psychology at least people who see the word "contrast" will indeed think of linear contrasts.

vincentarelbundock commented 1 year ago

FYI, I set up a CI system to check revdep, so I can now make sure that MatchIt et al. don't break with changes like this. So far so good.