Skip to content

Commit

Permalink
also test alternative arg works for crosstabs
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Mar 17, 2024
1 parent 0583a7e commit 845c625
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/contingency-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
1 13.3 1 0.000261 McNemar's Chi-squared test Cohen's g 0.333
conf.level conf.low conf.high conf.method n.obs
<dbl> <dbl> <dbl> <chr> <int>
1 0.9 0.195 0.416 binomial 95
1 0.9 0.229 0.5 binomial 95

---

Expand All @@ -116,7 +116,7 @@
[[1]]
list(chi["McNemar"]^2 * "(" * 1 * ")" == "13.333", italic(p) ==
"2.607e-04", widehat(italic("g"))["Cohen"] == "0.333", CI["90%"] ~
"[" * "0.195", "0.416" * "]", italic("n")["pairs"] == "95")
"[" * "0.229", "0.500" * "]", italic("n")["pairs"] == "95")

# Goodness of Fit contingency_table works without counts
Expand Down Expand Up @@ -155,7 +155,7 @@
1 722. 1 3.92e-159 Chi-squared test for given probabilities Pearson's C
estimate conf.level conf.low conf.high conf.method conf.distribution n.obs
<dbl> <dbl> <dbl> <dbl> <chr> <chr> <int>
1 0.497 0.95 0.469 0.524 ncp chisq 2201
1 0.497 0.95 0.474 1 ncp chisq 2201

---

Expand All @@ -165,7 +165,7 @@
[[1]]
list(chi["gof"]^2 * "(" * 1 * ")" == "722.45", italic(p) == "3.92e-159",
widehat(italic("C"))["Pearson"] == "0.50", CI["95%"] ~ "[" *
"0.47", "0.52" * "]", italic("n")["obs"] == "2,201")
"0.47", "1.00" * "]", italic("n")["obs"] == "2,201")

---
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-contingency-table.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test_that(
x = response_before,
y = response_after,
paired = TRUE,
alternative = "greater",
digits = 3L,
conf.level = 0.90
)
Expand Down Expand Up @@ -126,7 +127,8 @@ test_that(
df2 <- contingency_table(
data = as.data.frame(Titanic),
x = Sex,
counts = Freq
counts = Freq,
alternative = "greater"
)

set.seed(123)
Expand Down

0 comments on commit 845c625

Please sign in to comment.