Skip to content

Commit

Permalink
removed mean from labels and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
artiom-matvei committed Nov 5, 2024
1 parent 3b75005 commit b684443
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
28 changes: 14 additions & 14 deletions marginaleffects/sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,26 @@ def sanitize_comparison(comparison, by, wts=None):

lab = {
"difference": "{hi} - {lo}",
"differenceavg": "mean({hi}) - mean({lo})",
"differenceavgwts": "mean({hi}) - mean({lo})",
"differenceavg": "{hi} - {lo}",
"differenceavgwts": "{hi} - {lo}",
"dydx": "dY/dX",
"eyex": "eY/eX",
"eydx": "eY/dX",
"dyex": "dY/eX",
"dydxavg": "mean(dY/dX)",
"eyexavg": "mean(eY/eX)",
"eydxavg": "mean(eY/dX)",
"dyexavg": "mean(dY/eX)",
"dydxavgwts": "mean(dY/dX)",
"eyexavgwts": "mean(eY/eX)",
"eydxavgwts": "mean(eY/dX)",
"dyexavgwts": "mean(dY/eX)",
"dydxavg": "dY/dX",
"eyexavg": "eY/eX",
"eydxavg": "eY/dX",
"dyexavg": "dY/eX",
"dydxavgwts": "dY/dX",
"eyexavgwts": "eY/eX",
"eydxavgwts": "eY/dX",
"dyexavgwts": "dY/eX",
"ratio": "{hi} / {lo}",
"ratioavg": "mean({hi}) / mean({lo})",
"ratioavgwts": "mean({hi}) / mean({lo})",
"ratioavg": "{hi} / {lo}",
"ratioavgwts": "{hi} / {lo}",
"lnratio": "ln({hi} / {lo})",
"lnratioavg": "ln(mean({hi}) / mean({lo}))",
"lnratioavgwts": "ln(mean({hi}) / mean({lo}))",
"lnratioavg": "ln({hi} / {lo})",
"lnratioavgwts": "ln({hi} / {lo})",
"lnor": "ln(odds({hi}) / odds({lo}))",
"lnoravg": "ln(odds({hi}) / odds({lo}))",
"lnoravgwts": "ln(odds({hi}) / odds({lo}))",
Expand Down
Binary file modified tests/images/plot_comparisons/discrete_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/images/plot_slopes/by_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion tests/test_jss.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ def test_hypotheses(impartiality_model):
assert c.shape[0] == 1

c = avg_comparisons(impartiality_model, variables="democracy", comparison="ratio")
assert c["contrast"][0] == "mean(Democracy) / mean(Autocracy)"
assert c["contrast"][0] == "Democracy / Autocracy"

c = avg_comparisons(impartiality_model, variables="democracy", comparison="differenceavg")
assert c["contrast"][0] == "Democracy - Autocracy"


@pytest.mark.parametrize(
Expand Down

0 comments on commit b684443

Please sign in to comment.